From 6909dbd146ad0adb902c651fffa68ff77638a637 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Fri, 22 Mar 2024 22:57:05 +0100 Subject: [PATCH] TS API for deletePost --- client-solid/src/Util/api.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client-solid/src/Util/api.ts b/client-solid/src/Util/api.ts index b1d01aa..865b04e 100644 --- a/client-solid/src/Util/api.ts +++ b/client-solid/src/Util/api.ts @@ -101,6 +101,17 @@ 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}`, { + method: "DELETE", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }); + return await r.json(); +} + // Send the registration request to the server export async function submitRegistration( username: string,