mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Added teams pages. Refactored hooks.
This commit is contained in:
parent
a2c202fa36
commit
9448aa3ab5
136 changed files with 387 additions and 287 deletions
|
|
@ -3,7 +3,7 @@ import { canDeleteTeam, canUpdateTeam, canViewTeam } from 'lib/auth';
|
|||
import { useAuth, useValidate } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { methodNotAllowed, notFound, ok, unauthorized } from 'next-basics';
|
||||
import { deleteTeam, getTeamById, updateTeam } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
|
||||
|
|
@ -44,9 +44,13 @@ export default async (
|
|||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const user = await getTeamById(teamId, { includeTeamUser: true });
|
||||
const team = await getTeamById(teamId, { includeTeamUser: true });
|
||||
|
||||
return ok(res, user);
|
||||
if (!team) {
|
||||
return notFound(res);
|
||||
}
|
||||
|
||||
return ok(res, team);
|
||||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue