Browse Source

revert sign in

AykutSarac 2 years ago
parent
commit
203d21a28a
2 changed files with 3 additions and 6 deletions
  1. 2 5
      src/containers/Modals/LoginModal/index.tsx
  2. 1 1
      src/pages/sign-in.tsx

+ 2 - 5
src/containers/Modals/LoginModal/index.tsx

@@ -1,14 +1,11 @@
 import React from "react";
-import { useRouter } from "next/router";
+import { altogic } from "src/api/altogic";
 import { Button } from "src/components/Button";
 import { Modal, ModalProps } from "src/components/Modal";
 
 export const LoginModal: React.FC<ModalProps> = ({ setVisible, visible }) => {
-  const { replace } = useRouter();
-
   const onSignIn = () => {
-    replace("/sign-in");
-    setVisible(false);
+    altogic.auth.signInWithProvider("google");
   };
 
   return (

+ 1 - 1
src/pages/sign-in.tsx

@@ -35,8 +35,8 @@ const SignIn = () => {
   const isAuthenticated = useUser(state => state.isAuthenticated);
 
   React.useEffect(() => {
-    if (isReady) tokenAuth();
     if (isAuthenticated) replace("/editor");
+    if (isReady) tokenAuth();
   }, [tokenAuth, isReady, isAuthenticated, replace]);
 
   const handleLoginClick = (provider: "github" | "google") => {