From 31e253eaefc24eb2f0bf7fde8039ee072e0f82c5 Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Tue, 14 Jan 2025 21:59:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=A7=E7=BB=AD=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=BC=96=E8=BE=91=E5=99=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/user/postEditor.vue | 31 ++++++++++++++++++ hooks/useMiaoFetch.ts | 7 ++-- pages/user/main.vue | 4 +-- pages/user/main/post/edit-[id].vue | 52 ++++++++++++++++++++++++++++-- server/api/posts/getPostContent.ts | 5 +-- 5 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 components/user/postEditor.vue diff --git a/components/user/postEditor.vue b/components/user/postEditor.vue new file mode 100644 index 0000000..830fc57 --- /dev/null +++ b/components/user/postEditor.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/hooks/useMiaoFetch.ts b/hooks/useMiaoFetch.ts index 7c6b792..3d4514e 100644 --- a/hooks/useMiaoFetch.ts +++ b/hooks/useMiaoFetch.ts @@ -37,8 +37,11 @@ export default function useFetch() { 'Authorization': `Bearer ${userStore.token}` } }), - getPost: (id: number) => $fetch(`/api/posts/getPost?id=${id}`, { - method: 'GET', + getPost: (id: number) => $fetch(`/api/posts/getPostContent`, { + method: 'post', + body: { + id + }, headers: { 'Authorization': `Bearer ${userStore.token}` } diff --git a/pages/user/main.vue b/pages/user/main.vue index 90fc02f..78b19d3 100644 --- a/pages/user/main.vue +++ b/pages/user/main.vue @@ -2,8 +2,8 @@
-