refactor: remove get server from preload

This commit is contained in:
Tristan Yang
2023-07-20 16:00:03 +08:00
parent 2ca6049a16
commit 4c5b5274e1
3 changed files with 7 additions and 25 deletions
-6
View File
@@ -1,7 +1,6 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { AuthData, RenewTokenResponse } from "@/types/auth";
// import { isNull, omitBy } from "lodash";
import {
KEY_EXPIRE,
KEY_LOGIN_USER,
@@ -12,8 +11,6 @@ import {
} from "../config";
import { StoredUser } from "./users";
// import { updateUsersByLogs } from './users';
interface State {
initialized: boolean;
guest: boolean;
@@ -71,7 +68,6 @@ const authDataSlice = createSlice({
},
updateLoginUser(state, { payload }: PayloadAction<Partial<StoredUser>>) {
if (!state.user) return;
const obj = { ...state.user, ...payload };
Object.keys(obj).forEach((key) => {
// @ts-ignore
@@ -80,7 +76,6 @@ const authDataSlice = createSlice({
delete obj[key];
}
});
console.log("upppp", obj);
state.user = obj;
localStorage.setItem(KEY_LOGIN_USER, JSON.stringify(obj));
},
@@ -94,7 +89,6 @@ const authDataSlice = createSlice({
localStorage.removeItem(KEY_REFRESH_TOKEN);
localStorage.removeItem(KEY_UID);
localStorage.removeItem(KEY_PWA_INSTALLED);
return emptyState;
},
updateInitialized(state, action: PayloadAction<boolean>) {