profile editor bug fixes
This commit is contained in:
parent
0cbeca833f
commit
16ae6d9c1c
4 changed files with 194 additions and 122 deletions
|
|
@ -33,12 +33,16 @@ async function handle(req: Request) {
|
|||
const friendly = /invalid|credential|old_password|incorrect/i.test(reason)
|
||||
? "Current password is incorrect"
|
||||
: reason;
|
||||
// Propagate upstream status (401/403/400…) so the UI can react.
|
||||
return NextResponse.json({ error: friendly }, { status: res.status });
|
||||
// Include upstream reason for debugging on the client
|
||||
return NextResponse.json({ error: friendly, debug: reason }, { status: res.status });
|
||||
}
|
||||
|
||||
return NextResponse.json({ ok: true });
|
||||
}
|
||||
|
||||
export async function POST(req: Request) { return handle(req); }
|
||||
export async function PATCH(req: Request) { return handle(req); }
|
||||
export async function POST(req: Request) {
|
||||
return handle(req);
|
||||
}
|
||||
export async function PATCH(req: Request) {
|
||||
return handle(req);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue