Fix new lists created with quick actions not showing up in the menu

This commit is contained in:
kolaente 2021-06-24 15:38:25 +02:00
parent 2b7e9856d8
commit b8c7dba0ef
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 29 additions and 21 deletions

View file

@ -51,15 +51,13 @@
<script>
import TaskService from '@/services/task'
import ListService from '@/services/list'
import NamespaceService from '@/services/namespace'
import TeamService from '@/services/team'
import TaskModel from '@/models/task'
import NamespaceModel from '@/models/namespace'
import TeamModel from '@/models/team'
import {CURRENT_LIST, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
import {CURRENT_LIST, LOADING, LOADING_MODULE, QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
import ListModel from '@/models/list'
const TYPE_LIST = 'list'
@ -91,9 +89,6 @@ export default {
foundTeams: [],
teamSearchTimeout: null,
teamService: null,
namespaceService: null,
listService: null,
}
},
computed: {
@ -148,8 +143,8 @@ export default {
},
loading() {
return this.taskService.loading ||
this.listService.loading ||
this.namespaceService.loading ||
(this.$store.state[LOADING] && this.$store.state[LOADING_MODULE] === 'namespaces') ||
(this.$store.state[LOADING] && this.$store.state[LOADING_MODULE] === 'lists') ||
this.teamService.loading
},
placeholder() {
@ -230,8 +225,6 @@ export default {
},
created() {
this.taskService = new TaskService()
this.listService = new ListService()
this.namespaceService = new NamespaceService()
this.teamService = new TeamService()
},
methods: {
@ -378,7 +371,7 @@ export default {
title: this.query,
namespaceId: this.currentList.namespaceId,
})
this.listService.create(newList)
this.$store.dispatch('lists/createList', newList)
.then(r => {
this.success({message: this.$t('list.create.createdSuccess')})
this.$router.push({name: 'list.index', params: {listId: r.id}})
@ -390,9 +383,9 @@ export default {
},
newNamespace() {
const newNamespace = new NamespaceModel({title: this.query})
this.namespaceService.create(newNamespace)
.then(r => {
this.$store.commit('namespaces/addNamespace', r)
this.$store.dispatch('namespaces/createNamespace', newNamespace)
.then(() => {
this.success({message: this.$t('namespace.create.success')})
this.closeQuickActions()
})

View file

@ -1,5 +1,6 @@
import Vue from 'vue'
import ListService from '@/services/list'
import {setLoading} from '@/store/helper'
const FavoriteListsNamespace = -2
@ -32,6 +33,7 @@ export default {
return ctx.dispatch('updateList', list)
},
createList(ctx, list) {
const cancel = setLoading(ctx, 'lists')
const listService = new ListService()
return listService.create(list)
@ -41,11 +43,11 @@ export default {
ctx.commit('setList', r)
return Promise.resolve(r)
})
.catch(e => {
return Promise.reject(e)
})
.catch(e => Promise.reject(e))
.finally(() => cancel())
},
updateList(ctx, list) {
const cancel = setLoading(ctx, 'lists')
const listService = new ListService()
return listService.update(list)
@ -69,6 +71,7 @@ export default {
ctx.commit('setList', list)
return Promise.reject(e)
})
.finally(() => cancel())
}
},
}

View file

@ -116,9 +116,7 @@ export default {
return Promise.resolve(r)
})
.catch(e => {
return Promise.reject(e)
})
.catch(e => Promise.reject(e))
.finally(() => {
cancel()
})
@ -136,6 +134,7 @@ export default {
}
},
deleteNamespace(ctx, namespace) {
const cancel = setLoading(ctx, 'namespaces')
const namespaceService = new NamespaceService()
return namespaceService.delete(namespace)
@ -143,7 +142,20 @@ export default {
ctx.commit('removeNamespaceById', namespace.id)
return Promise.resolve(r)
})
.catch(Promise.reject)
.catch(e => Promise.reject(e))
.finally(() => cancel())
},
createNamespace(ctx, namespace) {
const cancel = setLoading(ctx, 'namespaces')
const namespaceService = new NamespaceService()
return namespaceService.create(namespace)
.then(r => {
ctx.commit('addNamespace', r)
return Promise.resolve(r)
})
.catch(e => Promise.reject(e))
.finally(() => cancel())
},
},
}