diff options
Diffstat (limited to 'src/components')
-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); |