diff --git a/src/app/api/auth/delete/route.ts b/src/app/api/auth/delete/route.ts index 98608ff..30c8b63 100644 --- a/src/app/api/auth/delete/route.ts +++ b/src/app/api/auth/delete/route.ts @@ -5,11 +5,11 @@ import { prisma } from "@/lib/prisma"; export async function DELETE() { const session = await auth(); - if (!session) return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); + if (!session || !session.user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); try { await prisma.user.delete({ - where: { id: Number(session.user?.id!) }, + where: { id: Number(session.user.id) }, }); } catch (error) { console.error("Failed to delete user:", error); diff --git a/src/app/components/carousel.tsx b/src/app/components/carousel.tsx index c294d7e..c304a57 100644 --- a/src/app/components/carousel.tsx +++ b/src/app/components/carousel.tsx @@ -28,7 +28,7 @@ export default function Carousel({ images, className }: Props) { return (
-
+
{images.map((src, index) => (
diff --git a/src/app/components/mii-list/pagination.tsx b/src/app/components/mii-list/pagination.tsx index e0793a9..9b276bd 100644 --- a/src/app/components/mii-list/pagination.tsx +++ b/src/app/components/mii-list/pagination.tsx @@ -1,9 +1,9 @@ "use client"; -import { redirect, useSearchParams } from "next/navigation"; +import { useSearchParams } from "next/navigation"; import Link from "next/link"; -import { useEffect, useMemo, useState } from "react"; +import { useMemo } from "react"; import { Icon } from "@iconify/react"; interface Props { diff --git a/src/app/mii/[slug]/page.tsx b/src/app/mii/[slug]/page.tsx index 3ffaaba..784f7cd 100644 --- a/src/app/mii/[slug]/page.tsx +++ b/src/app/mii/[slug]/page.tsx @@ -57,9 +57,9 @@ export default async function MiiPage({ params }: Props) {
-

{mii?.name}

+

{mii.name}

- {mii?.tags.map((tag) => ( + {mii.tags.map((tag) => ( {tag} @@ -67,19 +67,19 @@ export default async function MiiPage({ params }: Props) {
- - By: @{mii?.user.username} + + By: @{mii.user.username} -

- Created: {mii?.createdAt.toLocaleDateString("en-GB", { month: "long", day: "2-digit", year: "numeric" })} +

+ Created: {mii.createdAt.toLocaleDateString("en-GB", { month: "long", day: "2-digit", year: "numeric" })}

0} + likes={mii._count.likedBy ?? 0} + miiId={mii.id} + isLiked={(mii.likedBy ?? []).length > 0} isLoggedIn={session?.user != null} big />