update
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import request from "@/app/_lib/request";
|
||||
import { BaseResponse, PageData } from "@/app/_types/base";
|
||||
import { PageData } from "@/app/_types/base";
|
||||
import {
|
||||
Article,
|
||||
ArticleDetail,
|
||||
@ -7,18 +6,30 @@ import {
|
||||
ArticleListParams,
|
||||
} from "@/app/_types/article";
|
||||
|
||||
export const listArticles = (params: ArticleListParams) =>
|
||||
request
|
||||
.get<never, BaseResponse<PageData<Article>>>("/article/list", {
|
||||
params,
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
});
|
||||
export const listArticles = (
|
||||
params: ArticleListParams,
|
||||
): Promise<PageData<Article>> =>
|
||||
fetch(
|
||||
`${process.env.NEXT_PUBLIC_BASE_URL}/article/list?${new URLSearchParams(
|
||||
params as Record<string, any>,
|
||||
)}`,
|
||||
{
|
||||
cache: "no-store",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((json) => json.data);
|
||||
|
||||
export const articleDetail = (params: ArticleDetailParams) =>
|
||||
request
|
||||
.get<never, BaseResponse<ArticleDetail>>("/pc/articleDetail", {
|
||||
params,
|
||||
})
|
||||
.then((res) => res.data);
|
||||
export const articleDetail = (
|
||||
params: ArticleDetailParams,
|
||||
): Promise<ArticleDetail> =>
|
||||
fetch(
|
||||
`${process.env.NEXT_PUBLIC_BASE_URL}/pc/articleDetail?${new URLSearchParams(
|
||||
params as Record<string, any>,
|
||||
)}`,
|
||||
{
|
||||
cache: "no-store",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((json) => json.data);
|
||||
|
Reference in New Issue
Block a user