Fix auth redirects and add rebuild startup scripts

This commit is contained in:
Nirodan
2026-01-22 12:02:37 +01:00
parent 1263f9d2ef
commit 9d7e0023f4
6 changed files with 43 additions and 9 deletions
+4 -2
View File
@@ -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');
}