restructure urls again

This commit is contained in:
j3d1 2019-12-12 17:53:37 +01:00
parent 31c7272893
commit 0f07f8b517
4 changed files with 25 additions and 13 deletions

View file

@ -67,7 +67,7 @@ export default {
views: [ views: [
{'title':'items','path':'items'}, {'title':'items','path':'items'},
{'title':'boxes','path':'boxes'}, {'title':'boxes','path':'boxes'},
{'title':'mass-edit','path':'/#'}, //{'title':'mass-edit','path':'massedit'},
], ],
links: [ links: [
{'title':'howto engel','path':'/howto/'} {'title':'howto engel','path':'/howto/'}

View file

@ -9,9 +9,10 @@ import Vue from 'vue';
Vue.use(VueRouter); Vue.use(VueRouter);
const routes = [ const routes = [
{ path: '/', redirect: '/items/36C3' }, { path: '/', redirect: '/36C3/items' },
{ path: '/boxes/:event', component: Boxes}, { path: '/howto', component: Error},
{ path: '/items/:event', component: Items}, { path: '/:event/boxes', name: 'boxes', component: Boxes},
{ path: '/:event/items', name: 'items', component: Items},
{ path: '*', component: Error}, { path: '*', component: Error},
]; ];

View file

@ -14,23 +14,22 @@ const store = new Vuex.Store({
events: Array, events: Array,
layout: 'cards', layout: 'cards',
loadedItems: Array, loadedItems: Array,
currentview: 'items', loadedBoxes: Array,
}, },
getters: { getters: {
getEventSlug: state => state.route.params.event, getEventSlug: state => state.route.params.event,
getActiveView: state => state.currentview, getActiveView: state => state.route.name,
}, },
mutations: { mutations: {
replaceEvents(state, events) { replaceEvents(state, events) {
state.events = events; state.events = events;
//if (!state.activeEvent || !events.includes(state.activeEvent))
// state.activeEvent = _.reverse(events)[0];
}, },
changeEvent(state, event) { changeEvent(state, event) {
router.push({path: `/${state.currentview}/${event.slug}`}); router.push({path: `/${event.slug}/${state.currentview}`});
}, },
changeView(state, link) { changeView(state, link) {
router.push({path: `/${link.path}/${state.route.params.event}`}); router.push({path: `/${state.route.params.event}/${link.path}`});
state.currentview = link.path;
}, },
replaceLoadedItems(state, newItems) { replaceLoadedItems(state, newItems) {
state.loadedItems = newItems; state.loadedItems = newItems;
@ -59,8 +58,6 @@ const store = new Vuex.Store({
auth: getAuth(), auth: getAuth(),
}); });
console.log(resp.data);
commit('replaceLoadedItems', resp.data); commit('replaceLoadedItems', resp.data);
} }
} }

View file

@ -1,10 +1,24 @@
<template> <template>
<p>boxes</p> <div class="container-fluid px-xl-5 mt-3">
<div class="row">
<div class="col-xl-8 offset-xl-2">
<Table
:columns="['iid', 'item_uid', 'bezeichnung', 'container']"
:items="[]"
:keyName="'item_uid'"
/>
</div>
</div>
</div>
</template> </template>
<script> <script>
import { mapState } from 'vuex';
import Table from '@/components/Table';
export default { export default {
name: 'Boxes', name: 'Boxes',
components: {Table},
computed: mapState(['loadedBoxes', 'layout']),
}; };
</script> </script>