fix article detail api

This commit is contained in:
Timi
2026-10-15 23:52:36 +08:00
parent 7fc24008cd
commit bfee2e6de6
4 changed files with 121 additions and 87 deletions
+7 -11
View File
@@ -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;