migrate Article api from blog

This commit is contained in:
Timi
2025-07-22 13:14:20 +08:00
parent 3546e88f2c
commit 56f874991d
2 changed files with 28 additions and 0 deletions

26
src/api/ArticleAPI.ts Normal file
View File

@@ -0,0 +1,26 @@
import { ArticleView, axios } from "timi-web";
/**
* 获取文章
*
* @param id 文章 ID
* @returns 文章数据
*/
async function view(id: number): Promise<ArticleView<any>> {
return axios.get(`/article/${id}`);
}
/**
* 喜欢文章后端有限调用1240ms 一次
*
* @param id 文章 ID
* @returns 最新喜欢数量
*/
async function like(id: number): Promise<number> {
return axios.get(`/article/like/${id}`);
}
export default {
view,
like,
};