fix: Cannot read properties of undefined (reading 'push')

This commit is contained in:
2025-12-04 09:49:27 +08:00
parent 9ad60e8925
commit 0eaa1d8e9f

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,7 +37,6 @@ httpClient.interceptors.response.use(
if (error.response.status === 401) {
const authStore = useAuthStore();
authStore.logout();
const router = useRouter();
// Redirect to login page
router.push('/login');
}