mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
18 lines
395 B
JavaScript
18 lines
395 B
JavaScript
|
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);
|
||
|
};
|