fix article detail api
This commit is contained in:
+7
-11
@@ -2,24 +2,20 @@ import type { Article } from "../types";
|
||||
import { axios } from "./BaseAPI";
|
||||
|
||||
export const ArticleAPI = {
|
||||
|
||||
/**
|
||||
* 获取文章
|
||||
*
|
||||
* @param id 文章 ID
|
||||
* @returns 文章数据
|
||||
*/
|
||||
async view(id: string): Promise<Article> {
|
||||
return axios.get(`/article/${id}`);
|
||||
async detail(id: string): Promise<Article> {
|
||||
return axios.post(`/article/detail`, null, {
|
||||
params: {
|
||||
id
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 喜欢文章,后端有限调用,1240ms 一次
|
||||
*
|
||||
* @param id 文章 ID
|
||||
* @returns 最新喜欢数量
|
||||
*/
|
||||
async like(id: string): Promise<number> {
|
||||
return axios.get(`/article/like/${id}`);
|
||||
}
|
||||
};
|
||||
|
||||
export default ArticleAPI;
|
||||
|
||||
+15
-3
@@ -1,5 +1,13 @@
|
||||
import { axios } from "./BaseAPI";
|
||||
import type { CaptchaData, Notify, NotifyDetail, NotifyManagementItem, Page, PageResult } from "../types";
|
||||
import type {
|
||||
CaptchaData,
|
||||
Notify,
|
||||
NotifyDetail,
|
||||
NotifyInternalCategory,
|
||||
NotifyManagementItem,
|
||||
Page,
|
||||
PageResult
|
||||
} from "../types";
|
||||
|
||||
const BASE_URI = "/notify/internal";
|
||||
const MANAGEMENT_BASE_URI = "/notify/management";
|
||||
@@ -49,9 +57,13 @@ export const NotifyAPI = {
|
||||
},
|
||||
|
||||
/** 查询当前用户的站内通知。 */
|
||||
async listInternal(page?: Page<NotifyDetail>, unreadOnly = false): Promise<PageResult<NotifyDetail>> {
|
||||
async listInternal(
|
||||
page?: Page<NotifyDetail>,
|
||||
unreadOnly = false,
|
||||
category?: NotifyInternalCategory
|
||||
): Promise<PageResult<NotifyDetail>> {
|
||||
return await axios.post(`${BASE_URI}/internal`, page, {
|
||||
params: { unreadOnly }
|
||||
params: { unreadOnly, category }
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ export type NotifyStatus = "WAITING" | "REMINDED" | "TIMEOUT" | "CANCEL" | "FAIL
|
||||
/** 通知内容类型 */
|
||||
export type NotifyContentType = "TEXT" | "TIP_TAP";
|
||||
|
||||
/** 站内通知分类。未传分类时查询全部通知。 */
|
||||
export type NotifyInternalCategory = "SYSTEM" | "ORDER" | "FOLLOW_UP";
|
||||
|
||||
/** 通知 */
|
||||
export type Notify = {
|
||||
/** 业务类型 */
|
||||
|
||||
Reference in New Issue
Block a user