From a65d6d9127c3fa7f6a8ecaec5d1ffd1f47c2bc98 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Tue, 3 Sep 2024 00:08:53 +0300 Subject: refactor: port to typescript --- frontend/src/components/Login.tsx | 1931 +++++++++++++++++++++++++++++++++++++ 1 file changed, 1931 insertions(+) create mode 100644 frontend/src/components/Login.tsx (limited to 'frontend/src/components/Login.tsx') diff --git a/frontend/src/components/Login.tsx b/frontend/src/components/Login.tsx new file mode 100644 index 0000000..adfa718 --- /dev/null +++ b/frontend/src/components/Login.tsx @@ -0,0 +1,1931 @@ +import React from 'react'; +import { Link, useNavigate } from 'react-router-dom'; + +import { ExitIcon, UserIcon, LoginIcon } from '../images/Images'; +import { UserProfile } from '../types/Profile'; +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 navigate = useNavigate(); + + const _logout = () => { + setProfile(undefined); + setToken(undefined); + API.user_logout(); + navigate("/"); + } + + return ( + <> + {profile + ? + ( + <> + + + + + + ) + : + ( + + + + )} + + ); +}; + +export default Login; -- cgit v1.2.3