Returning Promise<Response> from deletePost

This commit is contained in:
Imbus 2024-03-22 23:55:50 +01:00
parent 038b83e530
commit 3610a7413a

View file

@ -101,15 +101,14 @@ export async function getEngagementCount(postId: string): Promise<number> {
return data;
}
export async function deletePost(id: string, token: string): Promise<string> {
const r = await fetch(`/api/posts/${id}`, {
export async function deletePost(id: string, token: string): Promise<Response> {
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