email 자동 셋팅
This commit is contained in:
@@ -18,11 +18,12 @@ import { useStore } from '@/shared/model/store';
|
||||
import { getLocalStorage, setLocalStorage } from '@/shared/lib';
|
||||
import { StorageKeys } from '@/shared/constants/local-storage';
|
||||
import { HomeGroupsParams, HomeGroupsResponse } from '@/entities/home/model/types';
|
||||
import { BusinessPropertyByMidParams, BusinessPropertyByMidResponse, LoginResponse, ShortcutUserParams, ShortcutUserResponse } from '@/entities/user/model/types';
|
||||
import { BusinessPropertyByMidParams, BusinessPropertyByMidResponse, LoginResponse, ShortcutUserParams, ShortcutUserResponse, UserFindAuthMethodParams, UserFindAuthMethodResponse } from '@/entities/user/model/types';
|
||||
import { useCodesListByCodeClMutation } from '@/entities/common/api/use-codes-list-by-codeCl-mutaion';
|
||||
import { useShortcutUserMutation } from '@/entities/user/api/use-shortcut-user-mutation';
|
||||
import { useShortcutDefaultMutation } from '@/entities/user/api/use-shortcut-detault-mutation';
|
||||
import { useBusinessPropertyByMidMutation } from '@/entities/user/api/use-business-property-by-mid-mutation';
|
||||
import { useUserFindAuthMethodMutation } from '@/entities/user/api/use-user-find-authmethod-mutation';
|
||||
|
||||
export interface ContextType {
|
||||
setOnBack: (onBack: () => void) => void;
|
||||
@@ -65,6 +66,7 @@ export const SubLayout = () => {
|
||||
const { mutateAsync: shortcutUser } = useShortcutUserMutation();
|
||||
const { mutateAsync: shortcutDefault } = useShortcutDefaultMutation();
|
||||
const { mutateAsync: businessPropertyByMid } = useBusinessPropertyByMidMutation();
|
||||
const { mutateAsync: findAuthMethod } = useUserFindAuthMethodMutation();
|
||||
|
||||
const wrapperClassName = 'wrapper';
|
||||
|
||||
@@ -158,6 +160,34 @@ export const SubLayout = () => {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const callFindAuthMethod = () => {
|
||||
let userInfo = useStore.getState().UserStore.userInfo;
|
||||
if(!!userInfo.usrid && !! mid){
|
||||
let params: UserFindAuthMethodParams = {
|
||||
usrid: userInfo.usrid,
|
||||
mid: mid
|
||||
};
|
||||
findAuthMethod(params).then((rs: any) => {
|
||||
let emails = rs.emails.map((value: any, index: any) => {
|
||||
return value.content;
|
||||
});
|
||||
console.log('emails -->', emails)
|
||||
useStore.getState().UserStore.setUserEmails(emails);
|
||||
let options: Array<Record<string, string>> = emails.map((value: any, index: any) => {
|
||||
return {
|
||||
name: value,
|
||||
value: value
|
||||
};
|
||||
});
|
||||
useStore.getState().UserStore.setSelectOptionsEmails(options);
|
||||
if(!!emails[0]){
|
||||
useStore.getState().UserStore.setEmail(emails[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const handleLogin = useCallback(async () => {
|
||||
let userParmas;
|
||||
@@ -221,6 +251,7 @@ export const SubLayout = () => {
|
||||
useEffect(() => {
|
||||
if(!!mid){
|
||||
// callBusinessPropertyByMid();
|
||||
callFindAuthMethod();
|
||||
}
|
||||
}, [mid]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user