Skip to content

Commit 8ae0c63

Browse files
supalarrySeluj78
authored andcommitted
logout undefined store and router fix
1 parent 53a72ca commit 8ae0c63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

frontend/src/auth/logOut.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/* eslint-disable import/prefer-default-export */
22
import Axios from 'axios';
3+
import router from '../router';
4+
import store from '../store';
35

46
export const logOut = async () => {
7+
await store.dispatch('logout');
8+
await router.push('/accounts/signin');
59
await Axios.post('/auth/logout', {
610
access_token: localStorage.getItem(process.env.VUE_APP_ACCESS_TOKEN),
711
refresh_token: localStorage.getItem(process.env.VUE_APP_REFRESH_TOKEN),
@@ -10,6 +14,4 @@ export const logOut = async () => {
1014
localStorage.removeItem(process.env.VUE_APP_REFRESH_TOKEN);
1115
localStorage.removeItem(process.env.VUE_APP_VUEX_PERSISTED_STATE);
1216
localStorage.removeItem(process.env.VUE_APP_SECURE_LS_METADATA);
13-
await this.$store.dispatch('logout');
14-
await this.$router.push('/accounts/signin');
1517
};

0 commit comments

Comments
 (0)