From 57ac476e3303993ea523c43b7de638d4f1ce3e85 Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Thu, 25 Jul 2024 13:00:43 +0530 Subject: fixed bugs --- src/components/Login.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-59-g8ed1b