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.js | 61 ---------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 frontend/src/components/login.js (limited to 'frontend/src/components/login.js') diff --git a/frontend/src/components/login.js b/frontend/src/components/login.js deleted file mode 100644 index f86ad44..0000000 --- a/frontend/src/components/login.js +++ /dev/null @@ -1,61 +0,0 @@ -import React from 'react'; -import { Link } from "react-router-dom"; - -import "./login.css"; -import img1 from "../imgs/login.png" -import img2 from "../imgs/10.png" -import img3 from "../imgs/11.png" - - -export default function Login(prop) { -const {setToken,profile,setProfile} = prop -function login() { - window.location.href="https://lp.ardapektezol.com/api/v1/login" -} -function logout() { - setIsLoggedIn(false) - setProfile(null) - setToken(null) - fetch(`https://lp.ardapektezol.com/api/v1/token`,{'method':'DELETE'}) - .then(r=>window.location.href="/") -} -const [isLoggedIn, setIsLoggedIn] = React.useState(false); -React.useEffect(() => { - fetch(`https://lp.ardapektezol.com/api/v1/token`) - .then(r => r.json()) - .then(d => { - if (d.data != null) { - setToken(d.data.token) - } - }) - }, []); - - -React.useEffect(() => { - if(profile!==null){setIsLoggedIn(true)} - }, [profile]); - -return ( - <> - {isLoggedIn ? ( - - - - - ) : ( - - - - - )} - - ) -} - - -- cgit v1.2.3