email 자동 셋팅

This commit is contained in:
focp212@naver.com
2025-10-23 13:56:32 +09:00
parent fbc910caf9
commit d8ed11b4bf
10 changed files with 297 additions and 39 deletions

View File

@@ -13,11 +13,17 @@ export interface UserInfoState {
userFavorite: Array<UserFavorite>;
setUserFavorite: (update: SetStateAction<Array<UserFavorite>>) => void;
userMids: Array<string>;
userEmails: Array<string>;
setUserMids: (update: SetStateAction<Array<string>>) => void;
setUserEmails: (update: SetStateAction<Array<string>>) => void;
selectOptionsMids: Array<Record<string, string>>;
setSelectOptionsMids: (update: SetStateAction<Array<Record<string, string>>>) => void;
selectOptionsEmails: Array<Record<string, string>>;
setSelectOptionsEmails: (update: SetStateAction<Array<Record<string, string>>>) => void;
mid: string;
setMid: (update: SetStateAction<string>) => void;
email: string;
setEmail: (update: SetStateAction<string>) => void;
firstAccess: boolean;
setFirstAccess: (update: SetStateAction<boolean>) => void;
};
@@ -27,8 +33,11 @@ const initialUserInfoState = {
businessInfo: {} as BusinessInfo,
userFavorite: [] as Array<UserFavorite>,
userMids: [] as Array<string>,
userEmails: [] as Array<string>,
selectOptionsMids: [] as Array<Record<string, string>>,
selectOptionsEmails: [] as Array<Record<string, string>>,
mid: '' as string,
email: '' as string,
firstAccess: true as boolean,
} as UserInfoState;
@@ -97,6 +106,19 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
};
});
},
setUserEmails: (update) => {
set((state: UserInfoState) => {
const newUserEmails = (typeof update === 'function')
? update(state.userEmails): update;
return {
...state,
userEmails: [
...state.userEmails,
...newUserEmails
],
};
});
},
setSelectOptionsMids: (update) => {
set((state: UserInfoState) => {
const newSelectOptionsMids = (typeof update === 'function')
@@ -109,6 +131,18 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
};
});
},
setSelectOptionsEmails: (update) => {
set((state: UserInfoState) => {
const newSelectOptionsEmails = (typeof update === 'function')
? update(state.selectOptionsEmails): update;
return {
...state,
selectOptionsEmails: [
...newSelectOptionsEmails
],
};
});
},
setMid: (update) => {
set((state: UserInfoState) => {
const newMid = (typeof update === 'function')
@@ -119,6 +153,16 @@ export const createUserInfoStore = lens<UserInfoState>((set, get) => ({
}
});
},
setEmail: (update) => {
set((state: UserInfoState) => {
const newEmail = (typeof update === 'function')
? update(state.email): update;
return {
...state,
email: newEmail
}
});
},
setFirstAccess: (update) => {
set((state: UserInfoState) => {
const newFirstAccess = (typeof update === 'function')

View File

@@ -67,8 +67,8 @@ export interface UserExistsUseridParams {
export interface UserFindAuthMethodParams {
mid: string;
usrid: string;
idCL: string;
status: string;
idCL?: string;
status?: string;
page?: DefaultRequestPagination;
};