renamed a type + small improvements
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import type { NextApiRequest, NextApiResponse } from "next";
|
||||
import { getServerSession } from "next-auth/next";
|
||||
import { authOptions } from "pages/api/auth/[...nextauth]";
|
||||
|
||||
type Data = {
|
||||
message: string;
|
||||
data?: object;
|
||||
};
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse<Data>
|
||||
) {
|
||||
const session = await getServerSession(req, res, authOptions);
|
||||
|
||||
console.log(session);
|
||||
|
||||
if (!session) {
|
||||
res.status(401).json({ message: "You must be logged in." });
|
||||
return;
|
||||
}
|
||||
|
||||
return res.json({
|
||||
message: "Success",
|
||||
});
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import Dropdown from "@/components/Dropdown";
|
||||
import LinkCard from "@/components/LinkCard";
|
||||
import useCollectionStore from "@/store/collections";
|
||||
import useLinkStore from "@/store/links";
|
||||
import { CollectionIncludingMembers, Sort } from "@/types/global";
|
||||
import { CollectionIncludingMembersAndLinkCount, Sort } from "@/types/global";
|
||||
import {
|
||||
faEllipsis,
|
||||
faFolder,
|
||||
@@ -33,7 +33,7 @@ export default function Index() {
|
||||
const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst);
|
||||
|
||||
const [activeCollection, setActiveCollection] =
|
||||
useState<CollectionIncludingMembers>();
|
||||
useState<CollectionIncludingMembersAndLinkCount>();
|
||||
|
||||
useLinks({ collectionId: Number(router.query.id), sort: sortBy });
|
||||
|
||||
|
||||
+5
-1
@@ -77,7 +77,11 @@ export default function Dashboard() {
|
||||
<div className="flex flex-col md:flex-row md:items-center justify-evenly gap-2 mb-10">
|
||||
<div className="flex items-baseline gap-2">
|
||||
<p className="font-bold text-6xl bg-gradient-to-tr from-sky-500 to-slate-400 bg-clip-text text-transparent">
|
||||
{links.length}
|
||||
{collections.reduce(
|
||||
(accumulator, collection) =>
|
||||
accumulator + collection._count.links,
|
||||
0
|
||||
)}
|
||||
</p>
|
||||
<p className="text-sky-900 text-xl">
|
||||
Links
|
||||
|
||||
Reference in New Issue
Block a user