fix: check location.state first
This commit is contained in:
parent
b386ee365f
commit
9996752d94
@ -39,11 +39,13 @@ export const Login = ({ onLogin }: LoginProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (location.state) {
|
||||||
const queryUsername = location.state.username;
|
const queryUsername = location.state.username;
|
||||||
const queryPassword = location.state.password;
|
const queryPassword = location.state.password;
|
||||||
if (queryUsername) setUsername(queryUsername);
|
if (queryUsername) setUsername(queryUsername);
|
||||||
if (queryPassword) setPassword(queryPassword);
|
if (queryPassword) setPassword(queryPassword);
|
||||||
navigate(location.pathname, { replace: true });
|
navigate(location.pathname, { replace: true });
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user