display boxes

This commit is contained in:
j3d1 2019-12-12 19:25:55 +01:00
parent b6ab1a8bb5
commit 07ac93a8f7
2 changed files with 17 additions and 9 deletions

View file

@ -17,10 +17,7 @@ const store = new Vuex.Store({
loadedBoxes: [], loadedBoxes: [],
}, },
getters: { getters: {
getEventSlug: state => { getEventSlug: state => state.route && state.route.params.event? state.route.params.event : state.events.length ? state.events[0].slug : '36C3',
console.log('foo', state.events);
return state.route && state.route.params.event? state.route.params.event : state.events.length ? state.events[0].slug : '36C3';
},
getActiveView: state => state.route.name || 'items', getActiveView: state => state.route.name || 'items',
}, },
mutations: { mutations: {
@ -35,7 +32,10 @@ const store = new Vuex.Store({
}, },
setLayout(state, layout) { setLayout(state, layout) {
state.layout = layout; state.layout = layout;
} },
replaceBoxes(state, loadedBoxes) {
state.loadedBoxes = loadedBoxes;
},
}, },
actions: { actions: {
async loadEvents({ commit }) { async loadEvents({ commit }) {
@ -58,7 +58,14 @@ const store = new Vuex.Store({
}); });
commit('replaceLoadedItems', resp.data); commit('replaceLoadedItems', resp.data);
} },
async loadBoxes({ commit }) {
const resp = await axios.get('https://c3lf.de/api/1/boxes', {
auth: getAuth(),
});
commit('replaceBoxes', resp.data);
},
} }
}); });
@ -66,3 +73,4 @@ export default store;
store.dispatch('loadEvents'); store.dispatch('loadEvents');
store.dispatch('loadEventItems'); store.dispatch('loadEventItems');
store.dispatch('loadBoxes');

View file

@ -3,8 +3,8 @@
<div class="row"> <div class="row">
<div class="col-xl-8 offset-xl-2"> <div class="col-xl-8 offset-xl-2">
<Table <Table
:columns="['iid', 'item_uid', 'bezeichnung', 'container']" :columns="['cid', 'name']"
:items="[]" :items="loadedBoxes"
:keyName="'item_uid'" :keyName="'item_uid'"
/> />
</div> </div>