1
0

Fix quick actions not working when nonexisting lists where left over in history

This commit is contained in:
kolaente
2021-07-20 18:03:38 +02:00
parent 176c6462bb
commit d81b4117f5
6 changed files with 60 additions and 17 deletions

View File

@ -1,6 +1,7 @@
import Vue from 'vue'
import ListService from '@/services/list'
import {setLoading} from '@/store/helper'
import {removeListFromHistory} from '@/modules/listHistory.ts'
const FavoriteListsNamespace = -2
@ -17,6 +18,9 @@ export default {
Vue.set(state, l.id, l)
})
},
removeListById(state, list) {
delete state[list.id]
},
},
getters: {
getListById: state => id => {
@ -79,5 +83,21 @@ export default {
})
.finally(() => cancel())
},
deleteList(ctx, list) {
const cancel = setLoading(ctx, 'lists')
const listService = new ListService()
return listService.delete(list)
.then(r => {
ctx.commit('removeListById', list)
ctx.commit('namespaces/removeListFromNamespaceById', list, {root: true})
removeListFromHistory({id: list.id})
return Promise.resolve(r)
})
.catch(e => {
return Promise.reject(e)
})
.finally(() => cancel())
},
},
}