add login redirect

This commit is contained in:
AceDataCloud committed 2021-09-11 01:59:39 +08:00
1 parent a94be71c98
commit 2a5a5c601c
12 files changed
+113 -15

No files matched your search

+13 -5
View File
@@ -1,10 +1,7 @@
import { createStore, ActionContext } from 'vuex';
import { IUser } from '@/services/common/user/types';
interface IUser {
id: string;
}
interface IState {
export interface IState {
count: number;
accessToken: string | undefined;
refreshToken: string | undefined;
@@ -47,6 +44,17 @@ const store = createStore({
setUser({ commit }: ActionContext<IState, IState>, payload: IUser) {
commit('setUser', payload);
}
},
getters: {
authenticated(state) {
return !!state.accessToken;
},
accessToken(state) {
return state.accessToken;
},
refreshToken(state) {
return state.refreshToken;
}
}
});