Skip to content

Commit c1eee5f

Browse files
URGENT fix: update response status for existing user registration and adjust form submission handling
1 parent f14677b commit c1eee5f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/api/register/route.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ export async function GET(req) {
2222
setSessionCookie(sessionToken);
2323
return NextResponse.json(
2424
{ message: "User already registered!" },
25-
{ status: 400 }
25+
{ status: 201 }
2626
);
2727
}
28-
return NextResponse.json({ message: "User not found!" }, { status: 200 });
28+
return NextResponse.json(
29+
{ message: "No Existing User found!" },
30+
{ status: 200 }
31+
);
2932
}
3033

3134
export async function POST(req) {

app/register/RegForm.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function RegForm({ email, instituteCode, redirectUrl = "/" }) {
1919
setIsSubmitting(true);
2020
try {
2121
const res = await fetch("/api/register?email=" + email);
22-
if (!res.ok) {
22+
if (res.status === 201) {
2323
router.push(redirectUrl);
2424
return;
2525
}

0 commit comments

Comments
 (0)