You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What you were expecting:
Notification triggers when login func returns Promise.reject({message: 'Error notification'}); What happened instead:
I got only an error message in the console. Steps to reproduce:
Go to authProvider;
return Promise.reject({message: 'Error notification'}) in "login" func. Related code:
login: async (params: LoginParams) => {
const request = new Request(`/auth/login`, {
method: 'POST',
body: JSON.stringify(
{
username: params.username,
password: params.password,
},
),
headers: new Headers({ 'Content-Type': 'application/json' }),
});
try {
const response = await fetch(request);
if (response.status < 200 || response.status >= 300) {
return Promise.reject({ message: 'Invalid credentials' });
}
const authResponse = await response.json();
if (!authResponse.accessToken) {
return Promise.reject({
message: 'Your account is not active yet. Please contact some of the admins to take access.',
});
}
cookies.set('AccessToken', authResponse.accessToken);
} catch (e) {
return Promise.reject({ message: 'Something went wrong. Please, try again.' });
}
}
What you were expecting:
Notification triggers when login func returns Promise.reject({message: 'Error notification'});
What happened instead:
I got only an error message in the console.
Steps to reproduce:
Related code:
Other information:
https://marmelab.com/react-admin/doc/3.19/Authentication.html#:~:text=string%20%7C%20%7B%20message%3F%3A%20string%20%7D%20error%20message%20to%20display
Environment
The text was updated successfully, but these errors were encountered: