mirror of
https://github.com/modelec/urlsh-qrcode.git
synced 2026-01-18 16:57:25 +01:00
Update index.ts
This commit is contained in:
10
index.ts
10
index.ts
@@ -8,15 +8,15 @@ Bun.serve({
|
||||
if (req.method === "POST") {
|
||||
if (url.pathname === "/admin/add") {
|
||||
if (req.body) {
|
||||
const { urlData, password } = await req.json() as { urlData: string, password: string };
|
||||
if (urlData && password === Bun.env.ADMIN_PASSWORD) {
|
||||
const u = await prisma.url.create({
|
||||
const { u, password } = await req.json() as { u: string, password: string };
|
||||
if (u && password === Bun.env.ADMIN_PASSWORD) {
|
||||
const uu = await prisma.url.create({
|
||||
data: {
|
||||
url: urlData
|
||||
url: u
|
||||
}
|
||||
})
|
||||
|
||||
return new Response(JSON.stringify({body: u}), {
|
||||
return new Response(JSON.stringify({body: uu}), {
|
||||
status: 200
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user