diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-08-01 17:49:26 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-08-01 17:49:26 +0530 |
commit | bd933a5aace3ac4944bfe7f4b58b4908978b4950 (patch) | |
tree | b738f4c68d897c009ba7823d0e99f1f6b44a611d /src/pages/Login.jsx | |
parent | fb04271b5288e8fb5891b7d6326f4806d12b82d5 (diff) | |
download | admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.tar.gz admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.tar.bz2 admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.zip |
merge
Diffstat (limited to 'src/pages/Login.jsx')
-rw-r--r-- | src/pages/Login.jsx | 46 |
1 files changed, 0 insertions, 46 deletions
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 ( - <div> - <h1>Login</h1> - <form onSubmit={handleLogin}> - <input - type="text" - placeholder="Username" - value={username} - onChange={(e) => setUsername(e.target.value)} - /> - <input - type="password" - placeholder="Password" - value={password} - onChange={(e) => setPassword(e.target.value)} - /> - <button type="submit">Login</button> - </form> - </div> - ); -}; - -export default Login; |