refactor: lots updates

This commit is contained in:
zerosoul
2022-03-17 11:15:13 +08:00
parent 4bc9932d0f
commit f22c7a01cb
69 changed files with 4625 additions and 1640 deletions
+7 -1
View File
@@ -6,6 +6,12 @@ const initialState = {
expireTime: localStorage.getItem(KEY_EXPIRE) || new Date().getTime(),
refreshToken: localStorage.getItem(KEY_REFRESH_TOKEN),
};
const emptyState = {
uid: null,
token: null,
expireTime: new Date().getTime(),
refreshToken: null,
};
const authDataSlice = createSlice({
name: "authData",
initialState,
@@ -37,7 +43,7 @@ const authDataSlice = createSlice({
localStorage.removeItem(KEY_TOKEN);
localStorage.removeItem(KEY_REFRESH_TOKEN);
localStorage.removeItem(KEY_UID);
return initialState;
return emptyState;
},
setUid(state, action) {
const uid = action.payload;