Updated teams button.

This commit is contained in:
Mike Cao 2024-02-16 18:58:15 -08:00
parent 8048bc7866
commit 44393472cf
12 changed files with 46 additions and 55 deletions

View file

@ -2,16 +2,11 @@ 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);
const { user } = req.auth;
const teams = await getUserTeams(user.id);
user['teams'] = teams.data.map(n => n);
return ok(res, user);
};