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');
}
+1 -1
View File
@@ -6,7 +6,7 @@ function LogoutButton() {
const logout = async () => {
try {
await axios.post('/logout'); // sendet POST an /api/logout
await axios.post('/api/logout');
} catch (err) {
console.warn('Logout-Request fehlgeschlagen, ignoriere...');
}
+1 -1
View File
@@ -7,7 +7,7 @@ function Md5Tool() {
const hashPassword = async () => {
try {
const res = await axios.post('/hash/md5', { password: input });
const res = await axios.post('/api/hash/md5', { password: input });
setResult(res.data.md5);
} catch (err) {