fix: disable /random route cache
This commit is contained in:
parent
1006ae83f8
commit
def387d811
3 changed files with 17 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ import { prisma } from "@/lib/prisma";
|
||||||
import { RateLimit } from "@/lib/rate-limit";
|
import { RateLimit } from "@/lib/rate-limit";
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
export async function GET(request: NextRequest) {
|
||||||
const rateLimit = new RateLimit(request, 16);
|
const rateLimit = new RateLimit(request, 20);
|
||||||
const check = await rateLimit.handle();
|
const check = await rateLimit.handle();
|
||||||
if (check) return check;
|
if (check) return check;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { Icon } from "@iconify/react";
|
|
||||||
|
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
|
|
||||||
import SearchBar from "./search-bar";
|
import SearchBar from "./search-bar";
|
||||||
|
import RandomLink from "./random-link";
|
||||||
import ProfileOverview from "./profile-overview";
|
import ProfileOverview from "./profile-overview";
|
||||||
import LogoutButton from "./logout-button";
|
import LogoutButton from "./logout-button";
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default async function Header() {
|
||||||
return (
|
return (
|
||||||
<header className="sticky top-0 z-50 w-full p-4 grid grid-cols-3 gap-2 gap-x-4 items-center bg-amber-50 border-b-4 border-amber-500 shadow-md max-lg:grid-cols-2 max-md:grid-cols-1">
|
<header className="sticky top-0 z-50 w-full p-4 grid grid-cols-3 gap-2 gap-x-4 items-center bg-amber-50 border-b-4 border-amber-500 shadow-md max-lg:grid-cols-2 max-md:grid-cols-1">
|
||||||
<Link href={"/"} className="font-black text-3xl text-orange-400 flex items-center gap-2 max-md:justify-center max-md:col-span-2">
|
<Link href={"/"} className="font-black text-3xl text-orange-400 flex items-center gap-2 max-md:justify-center max-md:col-span-2">
|
||||||
<Image src="/logo.svg" width={56} height={56} alt="logo" />
|
<Image src="/logo.svg" width={56} height={45} alt="logo" />
|
||||||
TomodachiShare
|
TomodachiShare
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|
@ -24,9 +24,7 @@ export default async function Header() {
|
||||||
|
|
||||||
<ul className="flex justify-end gap-3 items-center h-11 *:h-full max-lg:col-span-2 max-md:justify-center">
|
<ul className="flex justify-end gap-3 items-center h-11 *:h-full max-lg:col-span-2 max-md:justify-center">
|
||||||
<li title="Random Mii">
|
<li title="Random Mii">
|
||||||
<Link href={"/random"} className="pill button !p-0 h-full aspect-square" data-tooltip="Go to a Random Mii">
|
<RandomLink />
|
||||||
<Icon icon="mdi:dice-3" fontSize={28} />
|
|
||||||
</Link>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={"/submit"} className="pill button h-full">
|
<Link href={"/submit"} className="pill button h-full">
|
||||||
|
|
|
||||||
13
src/components/random-link.tsx
Normal file
13
src/components/random-link.tsx
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
import { Icon } from "@iconify/react";
|
||||||
|
|
||||||
|
export default function RandomLink() {
|
||||||
|
return (
|
||||||
|
<Link href={"/random"} onClick={() => redirect("/random")} className="pill button !p-0 h-full aspect-square" data-tooltip="Go to a Random Mii">
|
||||||
|
<Icon icon="mdi:dice-3" fontSize={28} />
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue