From c11c58087ea2e8bded9bc288ebcd3bc4f442feb4 Mon Sep 17 00:00:00 2001 From: Kamil Klecha Date: Fri, 15 Oct 2021 00:20:45 +0200 Subject: [PATCH] Added logout --- src/App.vue | 6 +++++- src/store/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index ac5529c..4ee1f47 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,7 +11,7 @@ - + Wyloguj mdi-logout @@ -45,5 +45,9 @@ export default class App extends Vue { get module() { return this.auth ? Forecast : Login; } + + private logout() { + this.$store.dispatch('logout'); + } } diff --git a/src/store/index.ts b/src/store/index.ts index d85cd4c..1d435f7 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -12,7 +12,7 @@ export default new Vuex.Store({ storeUser(state, payload) { state.user = payload; }, - cleanUserData(state) { + clearUserData(state) { state.user = undefined; }, }, @@ -32,6 +32,9 @@ export default new Vuex.Store({ console.error(e); }) }, + logout({ commit }) { + commit('clearUserData'); + } }, getters: { auth: (state) => state.user !== undefined,