mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-13 16:18:05 +00:00
Refactor: Return username on successful sign-up
This commit is contained in:
@@ -6,6 +6,6 @@ export async function onRequestPost({ request, env }) {
|
|||||||
return new Response('User already exists', { status: 409 });
|
return new Response('User already exists', { status: 409 });
|
||||||
await env.D1_EV.prepare("INSERT INTO users (username, pass_hash) VALUES (?, ?)")
|
await env.D1_EV.prepare("INSERT INTO users (username, pass_hash) VALUES (?, ?)")
|
||||||
.bind(username, pass_hash).run();
|
.bind(username, pass_hash).run();
|
||||||
return Response.json({ success: true }, { status: 201 });
|
return Response.json({ success: true, username }, { status: 201 });
|
||||||
} catch (e) { return new Response(e.message, { status: 500 }); }
|
} catch (e) { return new Response(e.message, { status: 500 }); }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user