fix: 使用环境变量设置baseurl
This commit is contained in:
parent
c3fc9459b8
commit
3afe01f5f2
|
|
@ -1,9 +1,8 @@
|
|||
/// <reference types="vite/client" />
|
||||
/// <reference types="react-scripts" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_BASE_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
declare namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
readonly REACT_APP_API_BASE_URL: string;
|
||||
// Add other environment variables here
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios';
|
||||
import { File, FileUploadResponse } from '../types/file';
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000/api/v1';
|
||||
const API_BASE_URL = process.env.REACT_APP_API_BASE_URL || 'http://localhost:8000/api/v1';
|
||||
|
||||
// Create axios instance with default config
|
||||
const axiosInstance = axios.create({
|
||||
|
|
|
|||
Loading…
Reference in New Issue