feat: 统一页面布局与字体样式
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import axios from 'axios'
|
||||
import { useAuthStore } from '../store/authStore'
|
||||
|
||||
const API_BASE = import.meta.env.DEV ? 'http://localhost:3000/api/v1' : '/api/v1'
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/api/v1',
|
||||
baseURL: API_BASE,
|
||||
timeout: 30000,
|
||||
})
|
||||
|
||||
@@ -27,7 +29,7 @@ api.interceptors.response.use(
|
||||
try {
|
||||
const refreshToken = useAuthStore.getState().refreshToken
|
||||
if (!refreshToken) throw new Error('No refresh token')
|
||||
const res = await axios.post('/api/v1/auth/refresh', { refreshToken })
|
||||
const res = await axios.post(`${API_BASE}/auth/refresh`, { refreshToken })
|
||||
const newToken = res.data.data.accessToken
|
||||
useAuthStore.getState().updateToken(newToken)
|
||||
originalRequest.headers.Authorization = `Bearer ${newToken}`
|
||||
|
||||
Reference in New Issue
Block a user