mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +01:00
Added different methods to get user websites and teams.
This commit is contained in:
parent
5189486d6f
commit
f4aa8f9661
5 changed files with 58 additions and 12 deletions
|
|
@ -4,7 +4,8 @@ import { useAuth, useCors } from 'lib/middleware';
|
|||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { createWebsite, getUserWebsites } from 'queries';
|
||||
import { createWebsite } from 'queries';
|
||||
import userWebsites from 'pages/api/users/[id]/websites';
|
||||
|
||||
export interface WebsitesRequestBody {
|
||||
name: string;
|
||||
|
|
@ -24,9 +25,9 @@ export default async (
|
|||
} = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const websites = await getUserWebsites(userId);
|
||||
req.query.id = userId;
|
||||
|
||||
return ok(res, websites);
|
||||
return userWebsites(req, res);
|
||||
}
|
||||
|
||||
if (req.method === 'POST') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue