mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Updated forms usage.
This commit is contained in:
parent
fcb1767eb1
commit
d827b79c72
14 changed files with 205 additions and 152 deletions
|
|
@ -12,6 +12,7 @@ export interface TeamRequestQuery {
|
|||
|
||||
export interface TeamRequestBody {
|
||||
name: string;
|
||||
accessCode: string;
|
||||
}
|
||||
|
||||
export default async (
|
||||
|
|
@ -33,13 +34,14 @@ export default async (
|
|||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
const { name } = req.body;
|
||||
|
||||
if (!(await canUpdateTeam(req.auth, teamId))) {
|
||||
return unauthorized(res, 'You must be the owner of this team.');
|
||||
}
|
||||
|
||||
const updated = await updateTeam({ name }, { id: teamId });
|
||||
const { name, accessCode } = req.body;
|
||||
const data = { name, accessCode };
|
||||
|
||||
const updated = await updateTeam(data, { id: teamId });
|
||||
|
||||
return ok(res, updated);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue