aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-25 13:00:43 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-25 13:00:43 +0530
commit57ac476e3303993ea523c43b7de638d4f1ce3e85 (patch)
tree8078dd2da528fd59c64b29df038efb6f9c04fcfd /src/components
parent34297348929e64cc2948f6b675d00674f8e3c347 (diff)
downloadadmin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.tar.gz
admin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.tar.bz2
admin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.zip
fixed bugs
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Login.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/Login.js b/src/components/Login.js
index 1b0a9ed..c73b59a 100644
--- a/src/components/Login.js
+++ b/src/components/Login.js
@@ -9,12 +9,15 @@ function Login() {
const handleSubmit = async (event) => {
event.preventDefault();
try {
+ console.log('Attempting login with:', { username, password });
const response = await axios.post('http://localhost:5000/login', {
username,
password,
});
- console.log(response.data);
- // handle successful login, e.g., redirect to admin panel
+ const { token } = response.data;
+ console.log('Login successful, token:', token);
+ localStorage.setItem('jwtToken', token);
+ // Redirect to admin panel or another page after successful login
} catch (error) {
setError('Invalid credentials');
console.error('Error logging in', error);