调整评论API

This commit is contained in:
宇阳
2024-08-14 12:50:45 +08:00
parent 017a7f0b73
commit eb0435d96c
5 changed files with 9 additions and 9 deletions

View File

@@ -17,11 +17,11 @@ export const editCommentDataAPI = (data: Comment) => Request<Comment>("PATCH", "
export const getCommentDataAPI = (id?: number) => Request<Paginate<Comment>>("GET", `/comment/${id}`)
// 获取评论列表
export const getCommentListAPI = (pagination?: Page) => {
export const getCommentListAPI = (pagination?: Page, pattern?: string) => {
if (pagination) {
const { page, size } = pagination
return Request<Paginate<Comment[]>>("GET", `/comment?page=${page}&size=${size}`);
} else {
return Request<Comment[]>("GET", `/comment/all`);
return Request<Comment[]>("GET", `/comment/all?pattern=${pattern ? pattern : "recursion"}`);
}
};

View File

@@ -13,5 +13,5 @@ export interface Article {
tagList: Tag[]
view?: number
count?: number,
createTime?: number,
createTime?: string,
}

5
src/types/Page.d.ts vendored
View File

@@ -1,5 +0,0 @@
interface Page {
page: number,
size: number,
total?: number
}

View File

@@ -13,3 +13,8 @@ interface Paginate<T> {
total: number,
result: T
}
interface Page {
page?: number,
size?: number,
}

View File

@@ -55,7 +55,7 @@ instance.interceptors.response.use(
if (err.response?.status === 401) {
Modal.error({
title: '暂无权限',
content: '🔒️ 登录已过期,是否重新登录?',
content: '🔒️ 登录已过期,重新登录?',
okText: "去登录",
onOk: () => {
const store = useUserStore.getState()