From d98f9842b8f931095b3477e89e3544c9c2f4ce78 Mon Sep 17 00:00:00 2001 From: wibus-wee <1596355173@qq.com> Date: Tue, 9 Aug 2022 15:09:11 +0800 Subject: [PATCH] fix(app): follow core url --- src/components/widgets/Lists/index.tsx | 10 +++++----- src/hooks/use-system.ts | 2 +- src/pages/Comments/index.tsx | 10 +++++----- src/router/router.tsx | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/widgets/Lists/index.tsx b/src/components/widgets/Lists/index.tsx index aa77055f..dcef4803 100644 --- a/src/components/widgets/Lists/index.tsx +++ b/src/components/widgets/Lists/index.tsx @@ -3,7 +3,7 @@ * @author: Wibus * @Date: 2022-07-15 17:06:10 * @LastEditors: Wibus - * @LastEditTime: 2022-07-30 17:35:06 + * @LastEditTime: 2022-08-09 15:08:33 * Coding With IU */ import { Table, Tabs } from "@geist-ui/core"; @@ -24,7 +24,7 @@ export const Lists = () => { .then((res) => { // console.log(res) const { data } = res as any; - const content = []; + const content = new Array(); for (const index of Object.keys(data)) { content.push({ title: data[index].title, @@ -37,7 +37,7 @@ export const Lists = () => { setArticle(content); }); await apiClient - .get("/comment", null, [ + .get("/comments", null, [ { key: "page", value: 1 }, { key: "size", value: 5 }, { key: "status", value: 0 }, @@ -45,7 +45,7 @@ export const Lists = () => { .then((res) => { // console.log(res) const { data } = res as any; - const content = []; + const content = new Array(); for (const index of Object.keys(data)) { content.push({ author: data[index].author, @@ -67,7 +67,7 @@ export const Lists = () => { .then((res) => { // console.log(res) const { data } = res as any; - const content = []; + const content = new Array(); for (const index of Object.keys(data)) { content.push({ name: data[index].name, diff --git a/src/hooks/use-system.ts b/src/hooks/use-system.ts index ceffc6b8..a3fdb117 100644 --- a/src/hooks/use-system.ts +++ b/src/hooks/use-system.ts @@ -15,7 +15,7 @@ enum SystemApi { categories = "/categories", tags = "/categories?type=Tag", users = "/user", - comment = "/comment", + comment = "/comments", aggregate = "/aggregate", links = "/links", init = "/init", diff --git a/src/pages/Comments/index.tsx b/src/pages/Comments/index.tsx index 9805ed9f..fb2c4430 100644 --- a/src/pages/Comments/index.tsx +++ b/src/pages/Comments/index.tsx @@ -3,7 +3,7 @@ * @author: Wibus * @Date: 2022-07-15 18:45:35 * @LastEditors: Wibus - * @LastEditTime: 2022-08-03 13:50:46 + * @LastEditTime: 2022-08-09 15:08:10 * Coding With IU */ @@ -48,7 +48,7 @@ export const Comments: BasicPage = () => { const request = async () => { await apiClient - .get("/comment", null, [ + .get("/comments", null, [ { key: "page", value: nowPage }, { key: "size", value: 5 }, { key: "status", value: Number(nowTab) - 1 }, @@ -231,7 +231,7 @@ export const Comments: BasicPage = () => { type="button" onClick={async () => { await apiClient - .patch(`/comment/${comment.id}`, null, null, { status: 1 }) + .patch(`/comments/${comment.id}`, null, null, { status: 1 }) .then((res) => { console.log(res); message.success(`已将 ${comment.author} 的评论标为已读`); @@ -246,7 +246,7 @@ export const Comments: BasicPage = () => { type="button" onClick={async () => { await apiClient - .patch(`/comment/${comment.id}`, null, null, { status: 2 }) + .patch(`/comments/${comment.id}`, null, null, { status: 2 }) .then(() => { message.success(`已将 ${comment.text} 的评论标为垃圾评论`); request(); @@ -402,7 +402,7 @@ export const Comments: BasicPage = () => { onClick={async () => { // console.log(reply.reply_text) await apiClient - .post(`/comment/master/reply/${reply.data.id}`, null, null, { + .post(`/comments/master/reply/${reply.data.id}`, null, null, { text: reply.reply_text, }) .then(() => { diff --git a/src/router/router.tsx b/src/router/router.tsx index c649bfb7..b3f2a6b5 100644 --- a/src/router/router.tsx +++ b/src/router/router.tsx @@ -3,7 +3,7 @@ * @author: Wibus * @Date: 2022-07-12 16:25:35 * @LastEditors: Wibus - * @LastEditTime: 2022-08-02 20:51:59 + * @LastEditTime: 2022-08-09 15:08:53 * Coding With IU */