MId 셋팅 변경
This commit is contained in:
@@ -9,11 +9,17 @@ export interface UserInfoState {
|
||||
resetUserInfo: () => void;
|
||||
userFavorite: Array<UserFavorite>;
|
||||
setUserFavorite: (update: SetStateAction<Array<UserFavorite>>) => void;
|
||||
userMids: Array<string>;
|
||||
setUserMids: (update: SetStateAction<Array<string>>) => void;
|
||||
selectOptionsMids: Array<Record<string, string>>;
|
||||
setSelectOptionsMids: (update: SetStateAction<Array<Record<string, string>>>) => void;
|
||||
};
|
||||
|
||||
const initialUserInfoState = {
|
||||
userInfo: {} as UserInfo,
|
||||
userFavorite: [] as Array<UserFavorite>
|
||||
userFavorite: [] as Array<UserFavorite>,
|
||||
userMids: [] as Array<string>,
|
||||
selectOptionsMids: [] as Array<Record<string, string>>
|
||||
} as UserInfoState;
|
||||
|
||||
export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
@@ -39,8 +45,8 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
window.localStorage.removeItem(StorageKeys.RefreshTokenExpiresIn);
|
||||
window.localStorage.removeItem(StorageKeys.MenuGrants);
|
||||
window.localStorage.removeItem(StorageKeys.Usrid);
|
||||
// window.localStorage.removeItem(StorageKeys.ClientAddressIP);
|
||||
// window.localStorage.removeItem(StorageKeys.Requires2FA);
|
||||
window.localStorage.removeItem(StorageKeys.ClientAddressIP);
|
||||
window.localStorage.removeItem(StorageKeys.Requires2FA);
|
||||
set(initialUserInfoState);
|
||||
},
|
||||
setUserFavorite: (update) => {
|
||||
@@ -49,10 +55,36 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
? update(state.userFavorite): update;
|
||||
return {
|
||||
...state,
|
||||
userFavorite: {
|
||||
userFavorite: [
|
||||
...state.userFavorite,
|
||||
...newUserFavorite
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
},
|
||||
setUserMids: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newUserMids = (typeof update === 'function')
|
||||
? update(state.userMids): update;
|
||||
return {
|
||||
...state,
|
||||
userMids: [
|
||||
...state.userMids,
|
||||
...newUserMids
|
||||
],
|
||||
};
|
||||
});
|
||||
},
|
||||
setSelectOptionsMids: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newSelectOptionsMids = (typeof update === 'function')
|
||||
? update(state.selectOptionsMids): update;
|
||||
return {
|
||||
...state,
|
||||
selectOptionsMids: [
|
||||
...state.selectOptionsMids,
|
||||
...newSelectOptionsMids
|
||||
],
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user