fix: add error feedback for failed login attempts
This commit is contained in:
@@ -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')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user