diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-25 13:00:43 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-25 13:00:43 +0530 |
commit | 57ac476e3303993ea523c43b7de638d4f1ce3e85 (patch) | |
tree | 8078dd2da528fd59c64b29df038efb6f9c04fcfd /src | |
parent | 34297348929e64cc2948f6b675d00674f8e3c347 (diff) | |
download | admin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.tar.gz admin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.tar.bz2 admin-panel-57ac476e3303993ea523c43b7de638d4f1ce3e85.zip |
fixed bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Login.js | 7 |
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); |