Files
d8d-admin-mobile-starter-pu…/client/mobile/api/index.ts
yourname ba64ad96ed 修改范围覆盖mobile/api目录下所有API文件(共9个,包括auth.ts)
统一使用index.ts中的全局axios配置
移除了所有重复的API_BASE_URL定义
简化了所有API调用路径格式
提高了代码一致性和可维护性
确保所有API功能保持正常
2025-05-13 09:31:30 +00:00

25 lines
717 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from 'axios';
// 基础配置
const API_BASE_URL = '/api';
// 全局axios配置
axios.defaults.baseURL = API_BASE_URL;
export * from './auth.ts';
export * from './user.ts';
export * from './file.ts';
export * from './theme.ts';
export * from './chart.ts';
export * from './home.ts';
export * from './map.ts';
export * from './system.ts';
export * from './message.ts';
// 获取OSS完整URL
export const getOssUrl = (path: string): string => {
// 获取全局配置中的OSS_HOST如果不存在使用默认值
const ossHost = (window.CONFIG?.OSS_BASE_URL) || '';
// 确保path不以/开头
const ossPath = path.startsWith('/') ? path.substring(1) : path;
return `${ossHost}/${ossPath}`;
};