summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModule.vue
diff options
context:
space:
mode:
authorUdo Walter2018-08-04 04:26:13 +0200
committerUdo Walter2018-08-04 04:26:13 +0200
commit8d7e7dab2c734b52408ed60f45fc240fd761f408 (patch)
tree1b417864590057c72641b191f6d58f69648e5cc5 /webapp/src/components/GroupModule.vue
parent[server/groups] add 404 status code if group / client id not found (diff)
downloadbas-8d7e7dab2c734b52408ed60f45fc240fd761f408.tar.gz
bas-8d7e7dab2c734b52408ed60f45fc240fd761f408.tar.xz
bas-8d7e7dab2c734b52408ed60f45fc240fd761f408.zip
[webapp/groups] bugfix + route to create group/client
Diffstat (limited to 'webapp/src/components/GroupModule.vue')
-rw-r--r--webapp/src/components/GroupModule.vue30
1 files changed, 17 insertions, 13 deletions
diff --git a/webapp/src/components/GroupModule.vue b/webapp/src/components/GroupModule.vue
index af0dfd8..29329b4 100644
--- a/webapp/src/components/GroupModule.vue
+++ b/webapp/src/components/GroupModule.vue
@@ -50,7 +50,7 @@ export default {
return [
{ name: 'home', path: '' },
{ name: 'group', path: ':id' },
- { name: 'client', path: 'client/:id'},
+ { name: 'client', path: 'client/:id' }
]
},
components: {
@@ -65,23 +65,26 @@ export default {
},
computed: {
...mapGetters(['tabsDark', 'tabsColor', 'tabsSliderColor']),
- ...mapState('groups', ['tabChain', 'activeTab', 'groupList', 'clientList']),
+ ...mapState('groups', ['tabChain', 'activeTab', 'groupList', 'clientList'])
},
watch: {
activeTab (index) {
this.$router.replace({
name: 'GroupModule.' + this.tabChain[index].tabType,
- params: { id: this.tabChain[index].id, noReload: true }
+ params: { id: this.tabChain[index].id || 'create', noReload: true }
})
}
},
methods: {
- ...mapMutations('groups', ['setActiveTab']),
+ ...mapMutations('groups', ['setActiveTab', 'setTab']),
loadItem (routeName, id) {
- if (routeName === 'GroupModule.group') {
- this.$store.dispatch('groups/loadGroup', { id, tabIndex: 1, switchTab: true })
- } else if (routeName === 'GroupModule.client') {
- this.$store.dispatch('groups/loadClient', { id, tabIndex: 1, switchTab: true })
+ const type = routeName.replace('GroupModule.', '')
+ if (id === 'create') {
+ this.setTab({ index: 1, item: { tabType: type } })
+ this.setActiveTab(1)
+ } else {
+ const action = type === 'group' ? 'loadGroup' : type === 'client' ? 'loadClient' : null
+ if (action) this.$store.dispatch('groups/loadGroup', { id, tabIndex: 1, switchTab: true })
}
}
},
@@ -89,13 +92,14 @@ export default {
if (this.groupList.length === 0 || this.clientList.length === 0) this.$store.dispatch('groups/loadLists')
if (this.tabChain.length === 0) this.$store.dispatch('groups/loadHome')
this.loadItem(this.$route.name, this.$route.params.id)
- this.$router.replace({
- name: 'GroupModule.' + this.tabChain[this.activeTab].tabType,
- params: { id: this.tabChain[this.activeTab].id, noReload: true }
- })
+ if (this.tabChain[this.activeTab].tabType !== 'home') {
+ this.$router.replace({
+ name: 'GroupModule.' + this.tabChain[this.activeTab].tabType,
+ params: { id: this.tabChain[this.activeTab].id, noReload: true }
+ })
+ }
},
beforeRouteUpdate (to, from, next) {
- console.log(to.name)
if (!to.params.noReload) this.loadItem(to.name, to.params.id)
next()
}