统一使用index.ts中的全局axios配置 移除了所有重复的API_BASE_URL定义

This commit is contained in:
yourname
2025-05-13 14:30:51 +00:00
parent b0aad49fd7
commit 4fbaad54ff

View File

@@ -1,5 +1,4 @@
import axios from 'axios';
import { API_BASE_URL } from './index.ts';
import type {
LoginLocation, LoginLocationDetail,
} from '../../share/types.ts';
@@ -30,7 +29,7 @@ export const MapAPI = {
userId?: number
}): Promise<LoginLocationResponse> => {
try {
const response = await axios.get(`${API_BASE_URL}/map/markers`, { params });
const response = await axios.get(`/map/markers`, { params });
return response.data;
} catch (error) {
throw error;
@@ -40,7 +39,7 @@ export const MapAPI = {
// 获取登录位置详情
getLocationDetail: async (locationId: number): Promise<LoginLocationDetailResponse> => {
try {
const response = await axios.get(`${API_BASE_URL}/map/location/${locationId}`);
const response = await axios.get(`/map/location/${locationId}`);
return response.data;
} catch (error) {
throw error;
@@ -54,7 +53,7 @@ export const MapAPI = {
location_name?: string;
}): Promise<LoginLocationUpdateResponse> => {
try {
const response = await axios.put(`${API_BASE_URL}/map/location/${locationId}`, data);
const response = await axios.put(`/map/location/${locationId}`, data);
return response.data;
} catch (error) {
throw error;