fix import path
This commit is contained in:
@@ -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
16
src/api/BaseAPI.ts
Normal 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);
|
||||
}
|
||||
});
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { axios, Developer } from "~/index";
|
||||
import { Developer } from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
const BASE_URI = "/git/developer";
|
||||
|
||||
|
||||
@@ -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
5
src/api/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from "./ArticleAPI";
|
||||
export * from "./CommentAPI";
|
||||
export * from "./CommonAPI";
|
||||
export * from "./DeveloperAPI"
|
||||
export * from "./UserAPI";
|
||||
Reference in New Issue
Block a user