feat: added delete link functionality

This commit is contained in:
Daniel
2023-03-23 18:55:17 +03:30
parent bcb467ea02
commit 2e3ec53d2a
8 changed files with 110 additions and 24 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ 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";
import deleteLink from "@/lib/api/controllers/links/deleteLink";
type Data = {
response: object[] | string;
@@ -19,5 +20,6 @@ export default async function (
}
if (req.method === "GET") return await getLinks(req, res, session);
if (req.method === "POST") return await postLink(req, res, session);
else if (req.method === "POST") return await postLink(req, res, session);
else if (req.method === "DELETE") return await deleteLink(req, res, session);
}