feat: add admin auth middleware
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import axios from 'axios';
|
||||
|
||||
// Create axios instance with default config
|
||||
@@ -12,11 +13,10 @@ const httpClient = axios.create({
|
||||
// Request interceptor
|
||||
httpClient.interceptors.request.use(
|
||||
config => {
|
||||
// You can add auth token here if needed
|
||||
// const token = localStorage.getItem('token');
|
||||
// if (token) {
|
||||
// config.headers.Authorization = `Bearer ${token}`;
|
||||
// }
|
||||
const authStore = useAuthStore();
|
||||
if (authStore.isAuthenticated && authStore.token) {
|
||||
config.headers.Authorization = `Bearer ${authStore.token}`;
|
||||
}
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
|
||||
Reference in New Issue
Block a user