mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Updated teams button.
This commit is contained in:
parent
8048bc7866
commit
44393472cf
12 changed files with 46 additions and 55 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import * as yup from 'yup';
|
||||
import { Team } from '@prisma/client';
|
||||
import { canCreateTeam } from 'lib/auth';
|
||||
import { uuid } from 'lib/crypto';
|
||||
|
|
@ -6,8 +7,7 @@ import { NextApiRequestQueryBody, SearchFilter } from 'lib/types';
|
|||
import { pageInfo } from 'lib/schema';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { getRandomChars, methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createTeam, getUserTeams } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
import { createTeam } from 'queries';
|
||||
|
||||
export interface TeamsRequestQuery extends SearchFilter {}
|
||||
export interface TeamsRequestBody {
|
||||
|
|
@ -34,18 +34,6 @@ export default async (
|
|||
user: { id: userId },
|
||||
} = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const results = await getUserTeams(userId, {
|
||||
page,
|
||||
query,
|
||||
pageSize,
|
||||
});
|
||||
|
||||
return ok(res, results);
|
||||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
if (!(await canCreateTeam(req.auth))) {
|
||||
return unauthorized(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue