Add Add multiple environments
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
import { message } from 'antd'
|
||||
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL: 'http://localhost:8181',
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
timeout: 10000,
|
||||
withCredentials: false
|
||||
})
|
||||
@@ -44,7 +44,7 @@ service.interceptors.request.use(
|
||||
jwt.exp * 1000 - new Date().getTime() > 0
|
||||
) {
|
||||
await axios
|
||||
.get('http://localhost:8181/token', {
|
||||
.get(import.meta.env.VITE_API_TOKEN_URL, {
|
||||
headers: { token }
|
||||
})
|
||||
.then((value: AxiosResponse<_Response<Token>>) => {
|
||||
|
||||
9
src/vite-env.d.ts
vendored
9
src/vite-env.d.ts
vendored
@@ -1,5 +1,14 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_URL: string
|
||||
readonly VITE_API_TOKEN_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
|
||||
type RouteHandle = {
|
||||
name?: string
|
||||
menu?: boolean
|
||||
|
||||
Reference in New Issue
Block a user