fix: ui
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import router from '@/router';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import axios from 'axios';
|
||||
|
||||
@@ -32,7 +33,12 @@ httpClient.interceptors.response.use(
|
||||
error => {
|
||||
// Handle HTTP errors here
|
||||
if (error.response) {
|
||||
// Server responded with error status
|
||||
// Handle 401 Unauthorized
|
||||
if (error.response.status === 401) {
|
||||
const authStore = useAuthStore();
|
||||
authStore.logout();
|
||||
router.push('/login');
|
||||
}
|
||||
console.error('API Error:', error.response.status, error.response.data);
|
||||
} else if (error.request) {
|
||||
// Request made but no response received
|
||||
|
||||
Reference in New Issue
Block a user