Add clearvisits API endpoint and implement DELETE method***
***Handle error when no id is found in DELETE method*** ***Update deleteData function in log page to use clearvisits API endpoint
This commit is contained in:
@@ -52,6 +52,15 @@ export async function DELETE(event: RequestEvent): Promise<Response> {
|
||||
// get id from the body
|
||||
const { id } = await event.request.json();
|
||||
|
||||
if (!id) {
|
||||
return new Response(JSON.stringify({ error: "No id found" }), {
|
||||
status: 400,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let res = await db
|
||||
.delete(userVisitedAdventures)
|
||||
.where(
|
||||
|
||||
Reference in New Issue
Block a user