Many improvements.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,24 @@
|
||||
import LinkList from "@/components/LinkList";
|
||||
import useLinkSlice from "@/store/links";
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function () {
|
||||
const router = useRouter();
|
||||
const { links } = useLinkSlice();
|
||||
|
||||
const collectionId = Number(router.query.id);
|
||||
const linksByCollection = links.filter(
|
||||
(e) => e.collectionId === Number(router.query.id)
|
||||
);
|
||||
|
||||
console.log(collectionId);
|
||||
|
||||
return <div>{"HI"}</div>;
|
||||
return (
|
||||
// ml-80
|
||||
<div className="p-5">
|
||||
<p className="text-center mb-5 text-gray-500 font-bold text-sm">
|
||||
{linksByCollection.length || 0} Links Found
|
||||
</p>
|
||||
{linksByCollection.map((e, i) => {
|
||||
return <LinkList key={i} link={e} count={i} />;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import useCollectionSlice from "@/store/collection";
|
||||
import useCollectionSlice from "@/store/collections";
|
||||
|
||||
import CollectionCard from "@/components/CollectionCard";
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export default function () {
|
||||
const router = useRouter();
|
||||
|
||||
const tagId = Number(router.query.id);
|
||||
|
||||
return <div>{"HI"}</div>;
|
||||
}
|
||||
Reference in New Issue
Block a user