Преглед изворни кода

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

yourname пре 6 месеци
родитељ
комит
4fbaad54ff
1 измењених фајлова са 3 додато и 4 уклоњено
  1. 3 4
      client/admin/api/maps.ts

+ 3 - 4
client/admin/api/maps.ts

@@ -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;