mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Refactor database queries.
This commit is contained in:
parent
a248f35db2
commit
f4ca353b5c
24 changed files with 371 additions and 329 deletions
17
pages/api/websites.js
Normal file
17
pages/api/websites.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { getUserWebsites } from 'lib/queries';
|
||||
import { useAuth } from 'lib/middleware';
|
||||
import { ok, methodNotAllowed } from 'lib/response';
|
||||
|
||||
export default async (req, res) => {
|
||||
await useAuth(req, res);
|
||||
|
||||
const { user_id } = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const websites = await getUserWebsites(user_id);
|
||||
|
||||
return ok(res, websites);
|
||||
}
|
||||
|
||||
return methodNotAllowed(res);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue