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');
|
||||
}
|
||||
|
||||
@@ -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...');
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user