Clear notes from vuex store when logging out

This commit is contained in:
Hubert Van De Walle 2020-06-14 15:28:55 +02:00
parent dbf3b4344d
commit c4f95179c9
2 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,7 @@ export default {
}, },
methods: { methods: {
async logout() { async logout() {
this.$store.commit('notes/clear')
await this.$auth.logout() await this.$auth.logout()
}, },
toggleTheme() { toggleTheme() {

View File

@ -12,6 +12,10 @@ export const mutations = {
delete(state, uuid) { delete(state, uuid) {
state.notes = state.notes.filter((e) => e.uuid !== uuid) state.notes = state.notes.filter((e) => e.uuid !== uuid)
}, },
// used when logging out
clear(state) {
state.notes = []
},
} }
export const actions = { export const actions = {