Initial commit

Created from https://vercel.com/new
This commit is contained in:
WaylonWalker 2021-12-08 18:25:42 +00:00
commit 4047a7ec23
378 changed files with 29334 additions and 0 deletions

21
pages/api/accounts.js Normal file
View file

@ -0,0 +1,21 @@
import { getAccounts } from 'lib/queries';
import { useAuth } from 'lib/middleware';
import { ok, unauthorized, methodNotAllowed } from 'lib/response';
export default async (req, res) => {
await useAuth(req, res);
const { is_admin } = req.auth;
if (!is_admin) {
return unauthorized(res);
}
if (req.method === 'GET') {
const accounts = await getAccounts();
return ok(res, accounts);
}
return methodNotAllowed(res);
};