mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Refactored queries.
This commit is contained in:
parent
18e36aa7b3
commit
b16f5cc067
67 changed files with 523 additions and 576 deletions
|
|
@ -2,9 +2,16 @@ import { NextApiRequestAuth } from 'lib/types';
|
|||
import { useAuth } from 'lib/middleware';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { ok } from 'next-basics';
|
||||
import { getUserTeams } from 'queries/admin/team';
|
||||
|
||||
export default async (req: NextApiRequestAuth, res: NextApiResponse) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
return ok(res, req.auth.user);
|
||||
const { user } = req.auth;
|
||||
|
||||
const teams = await getUserTeams(user.id);
|
||||
|
||||
user['teams'] = teams.data.map(n => n);
|
||||
|
||||
return ok(res, user);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue