diff --git a/frontend/components/Navbar.vue b/frontend/components/Navbar.vue index 770595e..2121204 100644 --- a/frontend/components/Navbar.vue +++ b/frontend/components/Navbar.vue @@ -50,6 +50,7 @@ export default { }, methods: { async logout() { + this.$store.commit('notes/clear') await this.$auth.logout() }, toggleTheme() { diff --git a/frontend/store/notes.js b/frontend/store/notes.js index 196d7bc..aa23740 100644 --- a/frontend/store/notes.js +++ b/frontend/store/notes.js @@ -12,6 +12,10 @@ export const mutations = { delete(state, uuid) { state.notes = state.notes.filter((e) => e.uuid !== uuid) }, + // used when logging out + clear(state) { + state.notes = [] + }, } export const actions = {