Fix quick actions not working when nonexisting lists where left over in history
This commit is contained in:
@ -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())
|
||||
},
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user