From bd933a5aace3ac4944bfe7f4b58b4908978b4950 Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Thu, 1 Aug 2024 17:49:26 +0530 Subject: merge --- src/pages/Login.jsx | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/pages/Login.jsx (limited to 'src/pages/Login.jsx') diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx deleted file mode 100644 index 9d38aa9..0000000 --- a/src/pages/Login.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useState } from 'react'; -import axios from 'axios'; -import { useNavigate } from 'react-router-dom'; - -const Login = () => { - const [username, setUsername] = useState(''); - const [password, setPassword] = useState(''); - const navigate = useNavigate(); - - const handleLogin = async (e) => { - e.preventDefault(); - try { - const response = await axios.post('http://localhost:5000/login', { - username, - password, - }); - localStorage.setItem('token', response.data.token); - navigate('/dashboard'); - } catch (error) { - console.error(error); - } - }; - - return ( -
-

Login

-
- setUsername(e.target.value)} - /> - setPassword(e.target.value)} - /> - -
-
- ); -}; - -export default Login; -- cgit v1.2.3-59-g8ed1b