From 3610a7413a437a9a121f8cbe2e9c625df6a03451 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Fri, 22 Mar 2024 23:55:50 +0100 Subject: [PATCH] Returning Promise from deletePost --- client-solid/src/Util/api.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client-solid/src/Util/api.ts b/client-solid/src/Util/api.ts index 865b04e..ff0a77a 100644 --- a/client-solid/src/Util/api.ts +++ b/client-solid/src/Util/api.ts @@ -101,15 +101,14 @@ export async function getEngagementCount(postId: string): Promise { return data; } -export async function deletePost(id: string, token: string): Promise { - const r = await fetch(`/api/posts/${id}`, { +export async function deletePost(id: string, token: string): Promise { + return await fetch(`/api/posts/${id}`, { method: "DELETE", headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}`, }, }); - return await r.json(); } // Send the registration request to the server