Files
timi-web/src/api/ArticleAPI.ts
2026-04-02 16:52:48 +08:00

28 lines
500 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ArticleView } from "../types";
import { axios } from "./BaseAPI";
/**
* 获取文章
*
* @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,
};