Improve redirection when logging in with google
This commit is contained in:
parent
2e429535ab
commit
c6ff823601
1 changed files with 8 additions and 3 deletions
|
|
@ -1,12 +1,17 @@
|
|||
import { useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useSession } from "../contexts/SessionContext";
|
||||
|
||||
export const OAuthSigninPage = () => {
|
||||
const navigate = useNavigate();
|
||||
const { session } = useSession();
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
navigate("/");
|
||||
const interval = setInterval(() => {
|
||||
if (session) {
|
||||
navigate("/");
|
||||
}
|
||||
}, 100);
|
||||
}, [navigate]);
|
||||
return () => clearInterval(interval);
|
||||
}, [navigate, session]);
|
||||
return <></>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue