From c4f95179c9c9faf9110ad83e74770cc2438fc8d2 Mon Sep 17 00:00:00 2001 From: Hubert Van De Walle Date: Sun, 14 Jun 2020 15:28:55 +0200 Subject: [PATCH] Clear notes from vuex store when logging out --- frontend/components/Navbar.vue | 1 + frontend/store/notes.js | 4 ++++ 2 files changed, 5 insertions(+) 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 = {