feat: better error notifs for login
This commit is contained in:
@@ -53,8 +53,14 @@ const Login = () => {
|
|||||||
notify("success", t('login.welcome_notification'));
|
notify("success", t('login.welcome_notification'));
|
||||||
window.localStorage.setItem("user", JSON.stringify(data));
|
window.localStorage.setItem("user", JSON.stringify(data));
|
||||||
navigate("/");
|
navigate("/");
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
notify("error", t('login.error_notification'));
|
const errorResponse = err.response?.data;
|
||||||
|
|
||||||
|
const errorMessage = errorResponse?.code
|
||||||
|
? t(errorResponse.code)
|
||||||
|
: t('login.error.generic');
|
||||||
|
|
||||||
|
notify("error", errorMessage);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user