mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-06-28 14:44:15 +00:00
fix: stop double redirect on 'random mii' button
This commit is contained in:
parent
045308dcef
commit
32bcd0ec36
2 changed files with 2 additions and 11 deletions
|
|
@ -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}`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue