fix
All checks were successful
Build And Deploy Main / build-and-deploy (push) Successful in 30s

This commit is contained in:
2026-03-11 11:26:06 -04:00
parent adfad31741
commit f99addeb3a
3 changed files with 8 additions and 6 deletions

View File

@@ -32,7 +32,7 @@ function Layout() {
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item className="small-dropdown-item" onClick={() => AuthService.logout()}>Logout</Dropdown.Item>
<Dropdown.Item className="small-dropdown-item" onClick={() => AuthService.logout(null, true)}>Logout</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>

View File

@@ -4,10 +4,12 @@ const login = (data) => {
return http.post('/auth/login', data);
};
const logout = (data) => {
localStorage.removeItem('user');
localStorage.removeItem('token');
window.location.href="/login";
const logout = (data, shouldClearSession = false) => {
if (shouldClearSession) {
localStorage.removeItem('user');
localStorage.removeItem('token');
}
window.location.href = "/login";
};
const getCurrentUser = () => {

View File

@@ -19,7 +19,7 @@ const setup = () => {
}, (error) => {
console.log(error);
if (error!= null && [401, 403].includes(error.response?.status)) {
AuthService.logout();
AuthService.logout(null, true);
window.location.href='/login';
}
return Promise.reject(error);