This commit is contained in:
focp212@naver.com
2025-10-16 18:10:11 +09:00
parent fd502d71b2
commit f4e2fe4769
14 changed files with 421 additions and 138 deletions

View File

@@ -7,10 +7,19 @@ export interface BannerInfoState {
setBannerInfo: (update: SetStateAction<Partial<BannerInfo>>) => void;
};
const initialBannerInfoState = {
export interface CommonState {
serviceCodes: Array<any>;
setServiceCodes: (update: SetStateAction<Array<any>>) => void;
};
const initialBannerInfoState = {
bannerInfo: {} as BannerInfo,
} as BannerInfoState;
const initialCommonState = {
serviceCodes: [] as Array<any>,
} as CommonState;
export const createBannerInfoStore = lens<BannerInfoState>((set, get) => ({
...initialBannerInfoState,
setBannerInfo: (update) => {
@@ -28,3 +37,19 @@ export const createBannerInfoStore = lens<BannerInfoState>((set, get) => ({
},
}));
export const createCommonStore = lens<CommonState>((set, get) => ({
...initialCommonState,
setServiceCodes: (update) => {
set((state: CommonState) => {
const newServiceCodes = (typeof update === 'function')
? update(state.serviceCodes): update;
return {
...state,
serviceCodes: [
...newServiceCodes
]
};
});
}
}));