payment 이하 구조 변경

This commit is contained in:
focp212@naver.com
2025-10-10 12:45:02 +09:00
parent 18b2f9188a
commit 306629be53
18 changed files with 228 additions and 216 deletions

View File

@@ -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
}
});
}
}));