fix: Cannot read properties of undefined (reading 'push')
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
import { router } from '@/router';
|
||||||
import { useAuthStore } from '@/stores/auth';
|
import { useAuthStore } from '@/stores/auth';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
// Create axios instance with default config
|
// Create axios instance with default config
|
||||||
const httpClient = axios.create({
|
const httpClient = axios.create({
|
||||||
@@ -37,7 +37,6 @@ httpClient.interceptors.response.use(
|
|||||||
if (error.response.status === 401) {
|
if (error.response.status === 401) {
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
authStore.logout();
|
authStore.logout();
|
||||||
const router = useRouter();
|
|
||||||
// Redirect to login page
|
// Redirect to login page
|
||||||
router.push('/login');
|
router.push('/login');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user