Returning Promise<Response> from deletePost
This commit is contained in:
parent
038b83e530
commit
3610a7413a
1 changed files with 2 additions and 3 deletions
|
@ -101,15 +101,14 @@ export async function getEngagementCount(postId: string): Promise<number> {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function deletePost(id: string, token: string): Promise<string> {
|
export async function deletePost(id: string, token: string): Promise<Response> {
|
||||||
const r = await fetch(`/api/posts/${id}`, {
|
return await fetch(`/api/posts/${id}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
Authorization: `Bearer ${token}`,
|
Authorization: `Bearer ${token}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return await r.json();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the registration request to the server
|
// Send the registration request to the server
|
||||||
|
|
Loading…
Reference in a new issue