add delete

This commit is contained in:
creations 2025-05-28 08:19:50 -04:00
parent bf6fed2684
commit 78910f0b66
Signed by: creations
GPG key ID: 8F553AA4320FC711

View file

@ -129,6 +129,17 @@ serve({
);
}
if (url.pathname === "/delete") {
const user = await auth.getUser(req);
if (!user)
return withCors(
Response.json({ error: "Unauthorized" }, { status: 401 }),
req,
);
await sql`DELETE FROM timezones WHERE user_id = ${user.id}`;
return withCors(Response.json({ success: true }), req);
}
if (url.pathname === "/me") {
const user = await auth.getUser(req);
if (!user)