website refactor
This commit is contained in:
16
apps/website/hooks/auth/useForgotPassword.ts
Normal file
16
apps/website/hooks/auth/useForgotPassword.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useMutation, UseMutationOptions } from '@tanstack/react-query';
|
||||
import { useInject } from '@/lib/di/hooks/useInject';
|
||||
import { AUTH_SERVICE_TOKEN } from '@/lib/di/tokens';
|
||||
import { ApiError } from '@/lib/api/base/ApiError';
|
||||
import type { ForgotPasswordDTO } from '@/lib/types/generated/ForgotPasswordDTO';
|
||||
|
||||
export function useForgotPassword(
|
||||
options?: Omit<UseMutationOptions<{ message: string; magicLink?: string }, ApiError, ForgotPasswordDTO>, 'mutationFn'>
|
||||
) {
|
||||
const authService = useInject(AUTH_SERVICE_TOKEN);
|
||||
|
||||
return useMutation<{ message: string; magicLink?: string }, ApiError, ForgotPasswordDTO>({
|
||||
mutationFn: (params) => authService.forgotPassword(params),
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user