Fix auth redirects and add rebuild startup scripts
This commit is contained in:
@@ -9,10 +9,12 @@ function LoginForm() {
|
||||
|
||||
const login = async () => {
|
||||
try {
|
||||
const res = await axios.post('/login', { username, password });
|
||||
const res = await axios.post('/api/login', { username, password });
|
||||
localStorage.setItem('token', res.data.token);
|
||||
localStorage.setItem('role', res.data.role);
|
||||
navigate('/');
|
||||
navigate('/', { replace: true });
|
||||
// ensure nav + route state reflect the new token immediately
|
||||
window.location.href = '/';
|
||||
} catch (err) {
|
||||
alert('Login fehlgeschlagen');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user