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;
|
||||
|
||||
Reference in New Issue
Block a user