fix: use async action to change current list

This commit is contained in:
Dominik Pschenitschni 2021-10-16 20:44:39 +02:00
parent 7f5f44d7f0
commit a60ad77bdc
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
6 changed files with 8 additions and 8 deletions

View file

@ -117,7 +117,7 @@
@click="navigate"
:href="href"
class="list-menu-link"
:class="{'router-link-exact-active': isActive || currentList.id === l.id}"
:class="{'router-link-exact-active': isActive || currentList?.id === l.id}"
>
<span class="icon handle">
<icon icon="grip-lines"/>

View file

@ -139,7 +139,7 @@ export default {
const list = new ListModel(listData)
try {
const loadedList = await this.listService.get(list)
this.$store.commit(CURRENT_LIST, loadedList)
await this.$store.dispatch(CURRENT_LIST, loadedList)
this.setTitle(this.getListTitle(loadedList))
} finally {
this.listLoaded = this.$route.params.listId

View file

@ -137,7 +137,7 @@ export default {
}
const list = await this.backgroundService.update({id: backgroundId, listId: this.$route.params.listId})
this.$store.commit(CURRENT_LIST, list)
await this.$store.dispatch(CURRENT_LIST, list)
this.$store.commit('namespaces/setListInNamespaceById', list)
this.$message.success({message: this.$t('list.background.success')})
},
@ -148,14 +148,14 @@ export default {
}
const list = await this.backgroundUploadService.create(this.$route.params.listId, this.$refs.backgroundUploadInput.files[0])
this.$store.commit(CURRENT_LIST, list)
await this.$store.dispatch(CURRENT_LIST, list)
this.$store.commit('namespaces/setListInNamespaceById', list)
this.$message.success({message: this.$t('list.background.success')})
},
async removeBackground() {
const list = await this.listService.removeBackground(this.currentList)
this.$store.commit(CURRENT_LIST, list)
await this.$store.dispatch(CURRENT_LIST, list)
this.$store.commit('namespaces/setListInNamespaceById', list)
this.$message.success({message: this.$t('list.background.removeSuccess')})
this.$router.back()

View file

@ -103,7 +103,7 @@ export default {
async save() {
await this.$store.dispatch('lists/updateList', this.list)
this.$store.commit(CURRENT_LIST, this.list)
await this.$store.dispatch(CURRENT_LIST, this.list)
this.setTitle(this.$t('list.edit.title', {list: this.list.title}))
this.$message.success({message: this.$t('list.edit.success')})
this.$router.back()

View file

@ -60,7 +60,7 @@ export default {
const list = new ListModel({id: this.$route.params.listId})
this.list = await this.listService.get(list)
this.$store.commit(CURRENT_LIST, this.list)
await this.$store.dispatch(CURRENT_LIST, this.list)
// This will trigger the dynamic loading of components once we actually have all the data to pass to them
this.manageTeamsComponent = 'userTeam'
this.manageUsersComponent = 'userTeam'

View file

@ -510,7 +510,7 @@ export default {
},
parent: {
handler(parent) {
this.$store.commit(CURRENT_LIST, parent !== null ? parent.list : this.currentList)
this.$store.dispatch(CURRENT_LIST, parent !== null ? parent.list : this.currentList)
},
immediate: true,
},