From a7c282ca348c1e8e60559e5c064caee28ba11eec Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:34:12 +0300 Subject: refactor: so much shit --- frontend/src/components/Login.tsx | 1923 +------------------------------------ 1 file changed, 37 insertions(+), 1886 deletions(-) (limited to 'frontend/src/components/Login.tsx') diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx index 367dc72..a8c5503 100644 --- a/frontend/src/components/Login.tsx +++ b/frontend/src/components/Login.tsx @@ -7,22 +7,25 @@ import { API } from '../api/Api'; import "../css/Login.css"; interface LoginProps { - token?: string; setToken: React.Dispatch>; profile?: UserProfile; setProfile: React.Dispatch>; }; -const Login: React.FC = ({ token, setToken, profile, setProfile }) => { +const Login: React.FC = ({ setToken, profile, setProfile }) => { const navigate = useNavigate(); + const _login = () => { + window.location.href = "/api/v1/login"; + }; + const _logout = () => { setProfile(undefined); setToken(undefined); - API.user_logout(); + API.delete_token(); navigate("/"); - } + }; return ( <> @@ -30,1893 +33,41 @@ const Login: React.FC = ({ token, setToken, profile, setProfile }) = ? ( <> - - - - + {profile.profile ? + ( + <> + + + + + + ) + : + ( + <> + + + + + + ) + } ) : ( -