Fix admin login response missing token
The API was setting the session token as a cookie but not returning it in the JSON response. Login page expects token in the response to store in localStorage. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
d18213fc7d
commit
73cfd2a761
1 changed files with 4 additions and 1 deletions
|
|
@ -60,6 +60,7 @@ export async function POST(request: Request) {
|
|||
|
||||
const response = NextResponse.json({
|
||||
success: true,
|
||||
token: sessionToken,
|
||||
admin: { username, role: "super_admin" },
|
||||
});
|
||||
response.cookies.set("tia_admin_session", sessionToken, {
|
||||
|
|
@ -101,7 +102,9 @@ export async function POST(request: Request) {
|
|||
|
||||
const response = NextResponse.json({
|
||||
success: true,
|
||||
admin: { username: admin.username, role: admin.role },
|
||||
token: sessionToken,
|
||||
username: admin.username,
|
||||
role: admin.role,
|
||||
});
|
||||
response.cookies.set("tia_admin_session", sessionToken, {
|
||||
httpOnly: true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue