renamed a type + small improvements

This commit is contained in:
Daniel
2023-06-16 16:25:21 +03:30
parent 93558bb791
commit c1831b650d
18 changed files with 70 additions and 70 deletions
-26
View File
@@ -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 -2
View File
@@ -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
View File
@@ -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