mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
parent
f5896f071b
commit
170821e2f9
1 changed files with 4 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ import { checkPassword } from '@/lib/password';
|
||||||
import redis from '@/lib/redis';
|
import redis from '@/lib/redis';
|
||||||
import { parseRequest } from '@/lib/request';
|
import { parseRequest } from '@/lib/request';
|
||||||
import { json, unauthorized } from '@/lib/response';
|
import { json, unauthorized } from '@/lib/response';
|
||||||
import { getUserByUsername } from '@/queries/prisma';
|
import { getAllUserTeams, getUserByUsername } from '@/queries/prisma';
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
|
|
@ -39,8 +39,10 @@ export async function POST(request: Request) {
|
||||||
token = createSecureToken({ userId: user.id, role }, secret());
|
token = createSecureToken({ userId: user.id, role }, secret());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const teams = await getAllUserTeams(id);
|
||||||
|
|
||||||
return json({
|
return json({
|
||||||
token,
|
token,
|
||||||
user: { id, username, role, createdAt, isAdmin: role === ROLES.admin },
|
user: { id, username, role, createdAt, isAdmin: role === ROLES.admin, teams },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue