Many improvements.

This commit is contained in:
Daniel
2023-03-06 00:33:20 +03:30
parent f3e104aafe
commit cff10fa9b6
19 changed files with 314 additions and 79 deletions
+2
View File
@@ -1,6 +1,7 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { getServerSession } from "next-auth/next";
import { authOptions } from "pages/api/auth/[...nextauth]";
import getLinks from "@/lib/api/controllers/links/getLinks";
import postLink from "@/lib/api/controllers/links/postLink";
type Data = {
@@ -20,5 +21,6 @@ export default async function (
// Check if user is unauthorized to the collection (If isn't owner or doesn't has the required permission...)
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (req.method === "GET") return await getLinks(req, res, session);
if (req.method === "POST") return await postLink(req, res, session);
}