fix: add error feedback for failed login attempts

This commit is contained in:
2026-02-06 16:53:17 +08:00
parent 18803d07be
commit a506ebfccd

View File

@@ -22,10 +22,13 @@ apiClient.interceptors.response.use(
(response) => response, (response) => response,
(error) => { (error) => {
if (error.response?.status === 401) { if (error.response?.status === 401) {
const url = error.config?.url || '';
if (!url.includes('/auth/login')) {
localStorage.removeItem('authToken'); localStorage.removeItem('authToken');
localStorage.removeItem('currentUser'); localStorage.removeItem('currentUser');
window.location.href = '/login'; window.location.href = '/login';
} }
}
if (error.response?.status === 404) { if (error.response?.status === 404) {
const url = error.config?.url || ''; const url = error.config?.url || '';
if (url.includes('/query')) { if (url.includes('/query')) {