统一后台接口
This commit is contained in:
15
common/config.js
Normal file
15
common/config.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* API 配置
|
||||||
|
* 统一管理后端接口地址
|
||||||
|
*/
|
||||||
|
|
||||||
|
// API 基础地址
|
||||||
|
export const API_BASE_URL = 'https://api.huayang-star.com/'
|
||||||
|
|
||||||
|
// 导出完整的 API URL 构建函数
|
||||||
|
export function getApiUrl(path) {
|
||||||
|
// 确保 path 以 / 开头
|
||||||
|
const apiPath = path.startsWith('/') ? path : `/${path}`
|
||||||
|
return `${API_BASE_URL}${apiPath.replace(/^\//, '')}`
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user