This commit is contained in:
aaron 2025-03-01 22:04:25 +08:00
parent 89a3fb6b0e
commit 896123b3a2

View File

@ -2,15 +2,16 @@ import axios from 'axios'
// 根据环境变量确定基础URL // 根据环境变量确定基础URL
const getBaseURL = () => { const getBaseURL = () => {
const appEnv = import.meta.env.VUE_APP_ENV || 'local' // 从环境变量 APP_ENV 获取当前的环境
switch (appEnv) { const appEnv = process.env.APP_ENV || 'local'
case 'dev': switch (appEnv) {
return 'https://api-dev.beefast.co' case 'dev':
case 'prd': return 'https://api-dev.beefast.co'
return 'https://api.beefast.co' case 'prd':
default: return 'https://api.beefast.co'
return 'http://localhost:8000' default:
} return 'http://localhost:8000'
}
} }
// 创建 axios 实例 // 创建 axios 实例