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.Toggle>
<Dropdown.Menu> <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.Menu>
</Dropdown> </Dropdown>

View File

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

View File

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