From e16d5411d5250416ee9c8d3913fb2b5a6aa694c2 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Thu, 29 Jul 2021 17:11:31 +0200 Subject: [PATCH] add a logout button --- src/components/layout/TheHeader.vue | 10 +++++++++- src/store/modules/auth/actions.js | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/layout/TheHeader.vue b/src/components/layout/TheHeader.vue index d593e1a..85284b7 100644 --- a/src/components/layout/TheHeader.vue +++ b/src/components/layout/TheHeader.vue @@ -12,6 +12,9 @@
  • Login
  • +
  • + Logout +
  • @@ -20,9 +23,14 @@ diff --git a/src/store/modules/auth/actions.js b/src/store/modules/auth/actions.js index bc41cfb..73afa34 100644 --- a/src/store/modules/auth/actions.js +++ b/src/store/modules/auth/actions.js @@ -36,5 +36,12 @@ export default { const error = new Error(err.message); throw error; } + }, + logout(context) { + context.commit('setUser', { + token: null, + userId: null, + tokenExpiration: null + }); } };