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

View file

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