add delete
This commit is contained in:
parent
bf6fed2684
commit
78910f0b66
1 changed files with 11 additions and 0 deletions
11
src/index.ts
11
src/index.ts
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue