feat: update admin

This commit is contained in:
yanghao05
2025-04-29 15:45:30 +08:00
parent 844cd9d558
commit c9a254b02e
2 changed files with 28 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
import router from '@/router';
import { useAuthStore } from '@/stores/auth';
import axios from 'axios';
import { useRouter } from 'vue-router';
// Create axios instance with default config
const httpClient = axios.create({
@@ -37,6 +37,8 @@ httpClient.interceptors.response.use(
if (error.response.status === 401) {
const authStore = useAuthStore();
authStore.logout();
const router = useRouter();
// Redirect to login page
router.push('/login');
}
console.error('API Error:', error.response.status, error.response.data);