Engage endpoint

This commit is contained in:
Imbus 2024-03-22 21:28:20 +01:00
parent 6fcbb92691
commit d93dc7fd89
4 changed files with 73 additions and 0 deletions

View file

@ -126,3 +126,18 @@ export async function submitLogin(
if (response.ok) return await response.json();
}
/**
* Engage with a post.
* @param postId The id of the post to engage with.
* @param token The token of the user engaging with the post.
* @returns {Promise<Response>} A promise that resolves to a Response object.
*/
export async function engage(postId: string, token: string): Promise<Response> {
return await fetch(`/api/posts/${postId}/engage`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
});
}