|
|
@ -17,6 +17,7 @@ export interface UPLoginRequest { |
|
|
|
password: string; |
|
|
|
code: string; |
|
|
|
} |
|
|
|
export interface LoginResponse {} |
|
|
|
|
|
|
|
export const authAtom = atom<IAuth>({ |
|
|
|
isLogin: false, |
|
|
@ -31,30 +32,30 @@ const devLogin = { |
|
|
|
export const upLoginFormAtom = atom<UPLoginRequest>({ |
|
|
|
...(isDev ? devLogin : {}), |
|
|
|
} as UPLoginRequest); |
|
|
|
|
|
|
|
export const upLoginAtom = atomWithMutation<any, System.LoginRequest>((get) => ({ |
|
|
|
//============================================================================================================登录 登出
|
|
|
|
export const upLoginAtom = atomWithMutation<any, UPLoginRequest>((get) => ({ |
|
|
|
mutationKey: ["uplogin"], |
|
|
|
mutationFn: async (params) => { |
|
|
|
mutationFn: async (params: UPLoginRequest) => { |
|
|
|
return await systemServ.uplogin(params); |
|
|
|
}, |
|
|
|
onSuccess: (res) => { |
|
|
|
message.success(t("login.success")); |
|
|
|
// console.log('login success', res)
|
|
|
|
get(userMenuDataAtom).refetch().then(); |
|
|
|
return res.data; |
|
|
|
}, |
|
|
|
retry: false, |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
export const emailCodeAtom = atomWithMutation<any, any>((get) => ({ |
|
|
|
mutationKey: ["emailCode"], |
|
|
|
mutationFn: async (params) => { |
|
|
|
return await systemServ.emailCode(params); |
|
|
|
}, |
|
|
|
onSuccess: (res) => { |
|
|
|
message.success(t("login.success")); |
|
|
|
//message.success(t("login.success"));
|
|
|
|
// console.log('login success', res)
|
|
|
|
get(userMenuDataAtom).refetch().then(); |
|
|
|
//get(userMenuDataAtom).refetch().then();
|
|
|
|
return res.data; |
|
|
|
}, |
|
|
|
retry: false, |
|
|
@ -67,7 +68,6 @@ export const emailLoginAtom = atomWithMutation<any, any>((get) => ({ |
|
|
|
onSuccess: (res) => { |
|
|
|
message.success(t("login.success")); |
|
|
|
// console.log('login success', res)
|
|
|
|
get(userMenuDataAtom).refetch().then(); |
|
|
|
return res.data; |
|
|
|
}, |
|
|
|
retry: false, |
|
|
@ -80,7 +80,7 @@ export const logoutAtom = atomWithMutation(() => ({ |
|
|
|
return true; |
|
|
|
}, |
|
|
|
})); |
|
|
|
|
|
|
|
//============================================================================================================
|
|
|
|
export const currentStaticUserAtom = atomWithStorage<IUserInfo | null>("user", null); |
|
|
|
|
|
|
|
export const currentUserAtom = atomWithQuery<IApiResult<System.IUserInfo>, any, System.IUserInfo>((get) => { |
|
|
|