Using react-admin.
I have the same question as this one, because the answer didn't work neither to me nor to the person who asked (see the comments). After the major release update, is there another option to redirect to a custom page after the successful login?
The code:
Inside my custom authProvider, when checking authentication, I am trying to redirect to a custom page:
if (type === AUTH_CHECK) {
...
if (localStorage.getItem("pageID")) {
return Promise.resolve() // goes to Dashboard
else {
return Promise.resolve({ redirectTo: '/pages' }); // needs to go to a custom page
}
However, the Promise.resolve({ redirectTo: '/pages' })
simply does not work.
If I use Promise.reject({ redirectTo: '/pages' })
indeed, it tries to redirect to pages
, however, as the AUTH_CHECK
is failing, it returns to login and stay in loop.
I also tried put this code inside the AUTH_LOGIN, but it does not work as well.