diff --git a/src/app/random/route.ts b/src/app/random/page.tsx similarity index 60% rename from src/app/random/route.ts rename to src/app/random/page.tsx index 79c8a9b..bd19881 100644 --- a/src/app/random/route.ts +++ b/src/app/random/page.tsx @@ -1,14 +1,7 @@ -import { NextRequest } from "next/server"; import { redirect } from "next/navigation"; - import { prisma } from "@/lib/prisma"; -import { RateLimit } from "@/lib/rate-limit"; - -export async function GET(request: NextRequest) { - const rateLimit = new RateLimit(request, 20); - const check = await rateLimit.handle(); - if (check) return check; +export default async function RandomPage() { const count = await prisma.mii.count(); if (count === 0) redirect("/"); @@ -20,6 +13,5 @@ export async function GET(request: NextRequest) { }); if (!randomMii) redirect("/"); - redirect(`/mii/${randomMii.id}`); } diff --git a/src/components/random-link.tsx b/src/components/random-link.tsx index 2e5923e..959a6a4 100644 --- a/src/components/random-link.tsx +++ b/src/components/random-link.tsx @@ -1,12 +1,11 @@ "use client"; import Link from "next/link"; -import { redirect } from "next/navigation"; import { Icon } from "@iconify/react"; export default function RandomLink() { return ( - redirect("/random")} className="pill button !p-0 h-full aspect-square" data-tooltip="Go to a Random Mii"> + );