payment 이하 구조 변경
This commit is contained in:
@@ -2,6 +2,7 @@ import { lens } from '@dhmk/zustand-lens';
|
||||
import { SetStateAction } from 'react';
|
||||
import { UserFavorite, UserInfo } from './types';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
import { StatementSync } from 'node:sqlite';
|
||||
|
||||
export interface UserInfoState {
|
||||
userInfo: UserInfo;
|
||||
@@ -13,13 +14,16 @@ export interface UserInfoState {
|
||||
setUserMids: (update: SetStateAction<Array<string>>) => void;
|
||||
selectOptionsMids: Array<Record<string, string>>;
|
||||
setSelectOptionsMids: (update: SetStateAction<Array<Record<string, string>>>) => void;
|
||||
mid: string;
|
||||
setMid: (update: SetStateAction<string>) => void;
|
||||
};
|
||||
|
||||
const initialUserInfoState = {
|
||||
userInfo: {} as UserInfo,
|
||||
userFavorite: [] as Array<UserFavorite>,
|
||||
userMids: [] as Array<string>,
|
||||
selectOptionsMids: [] as Array<Record<string, string>>
|
||||
selectOptionsMids: [] as Array<Record<string, string>>,
|
||||
mid: '' as string
|
||||
} as UserInfoState;
|
||||
|
||||
export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
@@ -87,4 +91,14 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
|
||||
};
|
||||
});
|
||||
},
|
||||
setMid: (update) => {
|
||||
set((state: UserInfoState) => {
|
||||
const newMid = (typeof update === 'function')
|
||||
? update(state.mid): update;
|
||||
return {
|
||||
...state,
|
||||
mid: newMid
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user