aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/pages
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-31 12:37:38 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-31 12:37:38 +0530
commit1bc31e4d8c8d23230bdac1b2bd73e76c8d455222 (patch)
tree34b9da83aa8757e70f6b5a66747fc1ba4e6a9b78 /panel/src/pages
parent7dfbe0f363a434cfda5f9be996d194f03c36879c (diff)
downloadadmin-panel-1bc31e4d8c8d23230bdac1b2bd73e76c8d455222.tar.gz
admin-panel-1bc31e4d8c8d23230bdac1b2bd73e76c8d455222.tar.bz2
admin-panel-1bc31e4d8c8d23230bdac1b2bd73e76c8d455222.zip
update
Diffstat (limited to 'panel/src/pages')
-rw-r--r--panel/src/pages/LoginPage.jsx10
1 files changed, 10 insertions, 0 deletions
diff --git a/panel/src/pages/LoginPage.jsx b/panel/src/pages/LoginPage.jsx
index 37ce32f..f763325 100644
--- a/panel/src/pages/LoginPage.jsx
+++ b/panel/src/pages/LoginPage.jsx
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
+import { useNavigate } from 'react-router-dom'; // Import useNavigate
import { signInWithEmailAndPassword } from 'firebase/auth';
import { auth } from '../firebase';
@@ -6,17 +7,26 @@ const LoginPage = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [error, setError] = useState('');
+ const navigate = useNavigate(); // Get the navigation function
const handleLogin = async () => {
+ console.log('Attempting login...');
+ console.log('Email:', email);
+ console.log('Password:', password);
+
if (password.length < 8) {
setError('The password should be minimum 8 digits');
+ console.log('Error:', 'The password should be minimum 8 digits');
return;
}
try {
await signInWithEmailAndPassword(auth, email, password);
+ console.log('Login successful');
+ navigate('/dashboard'); // Redirect to the dashboard after successful login
} catch (error) {
setError(error.message);
+ console.log('Error:', error.message);
}
};