use-post-reset-password.tsx 644 B

1234567891011121314151617181920212223
  1. import { useMutation } from '@tanstack/react-query';
  2. import { authApi, UserResetPasswordReturn } from '../auth-api';
  3. import { BaseAxiosError } from '../../../../types';
  4. import { authQueryKeys } from '../auth-query-keys';
  5. export type UserResetPasswordData = {
  6. email: string;
  7. };
  8. export const useResetPasswordMutation = () => {
  9. return useMutation<
  10. UserResetPasswordReturn,
  11. BaseAxiosError,
  12. UserResetPasswordData,
  13. UserResetPasswordReturn
  14. >({
  15. mutationKey: authQueryKeys.resetPassword(),
  16. mutationFn: async (data) => {
  17. const response = await authApi.resetPassword(data);
  18. return response.data;
  19. }
  20. });
  21. };