diff --git a/src/containers/Modals/LoginModal/index.tsx b/src/containers/Modals/LoginModal/index.tsx index 30441aa..e06f98b 100644 --- a/src/containers/Modals/LoginModal/index.tsx +++ b/src/containers/Modals/LoginModal/index.tsx @@ -1,22 +1,20 @@ import React from "react"; -import { altogic } from "src/api/altogic"; +import Link from "next/link"; import { Button } from "src/components/Button"; import { Modal, ModalProps } from "src/components/Modal"; export const LoginModal: React.FC = ({ setVisible, visible }) => { - const onSignIn = () => { - altogic.auth.signInWithProvider("google"); - }; - return ( Login

Welcome Back!

Login to unlock full potential of JSON Crack!

- + + +
diff --git a/src/pages/sign-in.tsx b/src/pages/sign-in.tsx index 97fcb56..7cca2d5 100644 --- a/src/pages/sign-in.tsx +++ b/src/pages/sign-in.tsx @@ -31,13 +31,13 @@ const StyledLoginButtons = styled.div` const SignIn = () => { const { isReady, replace } = useRouter(); - const tokenAuth = useUser(state => state.tokenAuth); + const checkSession = useUser(state => state.checkSession); const isAuthenticated = useUser(state => state.isAuthenticated); React.useEffect(() => { - if (isAuthenticated) replace("/editor"); - if (isReady) tokenAuth(); - }, [tokenAuth, isReady, isAuthenticated, replace]); + if (!isReady) checkSession(); + if (isAuthenticated) replace("/editor"); + }, [isReady, isAuthenticated, replace, checkSession]); const handleLoginClick = (provider: "github" | "google") => { altogic.auth.signInWithProvider(provider);