fix import path

This commit is contained in:
Timi
2026-04-02 16:52:48 +08:00
parent cdaf858a53
commit c266c9e95b
44 changed files with 180 additions and 194 deletions

View File

@@ -1,4 +1,5 @@
import { ArticleView, axios } from "timi-web";
import { ArticleView } from "../types";
import { axios } from "./BaseAPI";
/**
* 获取文章

16
src/api/BaseAPI.ts Normal file
View File

@@ -0,0 +1,16 @@
import Network from "../utils/Network";
let serviceAxios: any | null = null;
function getServiceAxios(): any {
if (serviceAxios === null) {
serviceAxios = Network.axios;
}
return serviceAxios;
}
export const axios = new Proxy({} as any, {
get(_target: any, prop: string | symbol, receiver: any): any {
return Reflect.get(getServiceAxios(), prop, receiver);
}
});

View File

@@ -1,4 +1,5 @@
import { axios, CaptchaData, Comment, CommentReply, Page, PageResult } from "~/index";
import { CaptchaData, Comment, CommentReply, Page, PageResult } from "../types";
import { axios } from "./BaseAPI";
const BASE_URI = "/comment";

View File

@@ -1,4 +1,6 @@
import { axios, SettingKey, TemplateBizType, Toolkit } from "~/index";
import { TemplateBizType } from "../types";
import Toolkit from "../utils/Toolkit";
import { axios } from "./BaseAPI";
const getCaptchaAPI = () => axios.defaults.baseURL + "/captcha";

View File

@@ -1,4 +1,5 @@
import { axios, Developer } from "~/index";
import { Developer } from "../types";
import { axios } from "./BaseAPI";
const BASE_URI = "/git/developer";

View File

@@ -1,15 +1,15 @@
import {
Attachment,
axios,
CaptchaData,
CommonAPI,
LoginRequest,
LoginResponse,
RegisterRequest,
UserAttachType,
UserProfileView,
UserView
} from "~/index";
} from "../types";
import { axios } from "./BaseAPI";
import CommonAPI from "./CommonAPI";
const BASE_URI = "/user";

5
src/api/index.ts Normal file
View File

@@ -0,0 +1,5 @@
export * from "./ArticleAPI";
export * from "./CommentAPI";
export * from "./CommonAPI";
export * from "./DeveloperAPI"
export * from "./UserAPI";