From 4df2c483836fa894156033a24bde093cb2069fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Zaninotto?= Date: Mon, 2 Sep 2024 11:55:23 +0200 Subject: [PATCH] Fix ResetPassword form doesn't redirect to login page Closes Missing redirection after password reset #70 --- packages/ra-supabase-core/src/useResetPassword.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/ra-supabase-core/src/useResetPassword.ts b/packages/ra-supabase-core/src/useResetPassword.ts index 283fac1..0563f7a 100644 --- a/packages/ra-supabase-core/src/useResetPassword.ts +++ b/packages/ra-supabase-core/src/useResetPassword.ts @@ -1,4 +1,10 @@ -import { OnError, OnSuccess, useAuthProvider, useNotify } from 'ra-core'; +import { + OnError, + OnSuccess, + useAuthProvider, + useNotify, + useRedirect, +} from 'ra-core'; import { useMutation, UseMutationResult } from '@tanstack/react-query'; import { ResetPasswordParams, SupabaseAuthProvider } from './authProvider'; @@ -33,6 +39,7 @@ export const useResetPassword = ( UseMutationResult ] => { const notify = useNotify(); + const redirect = useRedirect(); const authProvider = useAuthProvider(); if (authProvider == null) { @@ -49,6 +56,7 @@ export const useResetPassword = ( const { onSuccess = () => { + redirect('/login'); notify('ra-supabase.auth.password_reset', { type: 'info' }); }, onError = error => notify(error.message, { type: 'error' }),