Web: Login: fix redirect to home after login

This commit is contained in:
Artem Tarasov 2022-08-19 12:31:15 +03:00
parent 87d13d5d81
commit eb9146685e

View File

@ -109,9 +109,9 @@ const LoginForm: React.FC<ILoginFormProps> = ({
isDesktop && checkPwd();
const session = !isChecked;
login(user, hash, session)
.then((url: string) => {
.then((res: string | object) => {
const redirectPath = localStorage.getItem("redirectPath");
console.log(res);
if (redirectPath) {
localStorage.removeItem("redirectPath");
console.log("here");
@ -119,8 +119,8 @@ const LoginForm: React.FC<ILoginFormProps> = ({
return;
}
window.location.replace(url); //TODO: save { user, hash } for tfa
//history.push(url, { user, hash });
if (typeof res === "string") window.location.replace(res);
else window.location.replace("/"); //TODO: save { user, hash } for tfa
})
.catch((error) => {
setIsEmailErrorShow(true);