Skip to content

Commit fa3abbc

Browse files
author
Walker Leite
committed
fix(auth): redirect to login if token is expired
1 parent 92da75f commit fa3abbc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

template/client/store/modules/auth/actions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ export function signOut({commit}) {
9090
export function loadAccount({commit}, userId) {
9191
return loopback
9292
.get(`/Accounts/${userId}`)
93-
.then(acc => commit('setAccount', acc));
93+
.then(acc => commit('setAccount', acc))
94+
.catch(() => {
95+
loopback.removeToken();
96+
router.push({ name: 'login' });
97+
});
9498
}
9599

96100
/**

0 commit comments

Comments
 (0)