mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Update teams features.
This commit is contained in:
parent
89f2fd601e
commit
656df4f846
23 changed files with 278 additions and 113 deletions
|
|
@ -4,7 +4,7 @@ import { canCreateTeam } from 'lib/auth';
|
|||
import { uuid } from 'lib/crypto';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getRandomChars, methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createTeam, getUserTeams } from 'queries';
|
||||
|
||||
export interface TeamsRequestBody {
|
||||
|
|
@ -34,13 +34,14 @@ export default async (
|
|||
|
||||
const { name } = req.body;
|
||||
|
||||
const created = await createTeam({
|
||||
const team = await createTeam({
|
||||
id: uuid(),
|
||||
name,
|
||||
userId,
|
||||
accessCode: getRandomChars(16),
|
||||
});
|
||||
|
||||
return ok(res, created);
|
||||
return ok(res, team);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue