website refactor
This commit is contained in:
@@ -10,7 +10,13 @@ export function useForgotPassword(
|
||||
const authService = useInject(AUTH_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<{ message: string; magicLink?: string }, ApiError, ForgotPasswordDTO>({
|
||||
mutationFn: (params) => authService.forgotPassword(params),
|
||||
mutationFn: async (params) => {
|
||||
const result = await authService.forgotPassword(params);
|
||||
if (result.isErr()) {
|
||||
throw result.getError();
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -11,7 +11,13 @@ export function useLogin(
|
||||
const authService = useInject(AUTH_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<SessionViewModel, ApiError, LoginParamsDTO>({
|
||||
mutationFn: (params) => authService.login(params),
|
||||
mutationFn: async (params) => {
|
||||
const result = await authService.login(params);
|
||||
if (result.isErr()) {
|
||||
throw result.getError();
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -10,7 +10,13 @@ export function useResetPassword(
|
||||
const authService = useInject(AUTH_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<{ message: string }, ApiError, ResetPasswordDTO>({
|
||||
mutationFn: (params) => authService.resetPassword(params),
|
||||
mutationFn: async (params) => {
|
||||
const result = await authService.resetPassword(params);
|
||||
if (result.isErr()) {
|
||||
throw result.getError();
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -11,7 +11,13 @@ export function useSignup(
|
||||
const authService = useInject(AUTH_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<SessionViewModel, ApiError, SignupParamsDTO>({
|
||||
mutationFn: (params) => authService.signup(params),
|
||||
mutationFn: async (params) => {
|
||||
const result = await authService.signup(params);
|
||||
if (result.isErr()) {
|
||||
throw result.getError();
|
||||
}
|
||||
return result.unwrap();
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user