react query ftw
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// chatgpt
|
||||
function rewriteCookieDomain(rawCookie: string): string {
|
||||
return rawCookie
|
||||
.replace(/;?\s*Domain=[^;]+/i, '')
|
||||
.replace(/;?\s*Domain=[^;]+/i, "")
|
||||
.concat(`; Domain=localhost:3000`);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import Image from "next/image";
|
||||
import { QuickTopUI, QuickTopUILogoPart } from "@/components/site/QuickTopUI";
|
||||
import { ReactQueryProvider } from "@/components/providers/ReactQueryProvider";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
@@ -31,24 +32,26 @@ export default function RootLayout({
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased overflow-x-hidden`}
|
||||
>
|
||||
<TooltipProvider>
|
||||
<main>
|
||||
<Image
|
||||
/* window.localStorage.BgImageUrl */
|
||||
src={"/bg.png"}
|
||||
width={1920}
|
||||
height={1080}
|
||||
className="w-screen h-screen bg-blend-hard-light fixed top-0 left-0 blur-lg opacity-25"
|
||||
alt=""
|
||||
/>
|
||||
<div className="z-10 isolate overflow-scroll no-scrollbar w-screen max-h-screen h-screen antialiased overflow-x-hidden">
|
||||
<QuickTopUI />
|
||||
<QuickTopUILogoPart />
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
<Toaster />
|
||||
</TooltipProvider>
|
||||
<ReactQueryProvider>
|
||||
<TooltipProvider>
|
||||
<main>
|
||||
<Image
|
||||
/* window.localStorage.BgImageUrl */
|
||||
src={"/bg.png"}
|
||||
width={1920}
|
||||
height={1080}
|
||||
className="w-screen h-screen bg-blend-hard-light fixed top-0 left-0 blur-lg opacity-25"
|
||||
alt=""
|
||||
/>
|
||||
<div className="z-10 isolate overflow-scroll no-scrollbar w-screen max-h-screen h-screen antialiased overflow-x-hidden">
|
||||
<QuickTopUI />
|
||||
<QuickTopUILogoPart />
|
||||
{children}
|
||||
</div>
|
||||
</main>
|
||||
<Toaster />
|
||||
</TooltipProvider>
|
||||
</ReactQueryProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
17
app/page.tsx
17
app/page.tsx
@@ -13,17 +13,17 @@ import {
|
||||
OmniRecommendation
|
||||
} from "@/lib/omniRecommendation";
|
||||
import { loadThumbnails } from "@/lib/thumbnailLoader";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { AlertTriangleIcon } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Home() {
|
||||
const SORTS_ALLOWED_IDS = [100000003, 100000001];
|
||||
const [rec, setRec] = useState<OmniRecommendation | null>(null);
|
||||
useEffect(() => {
|
||||
setTimeout(async () => {
|
||||
|
||||
const { data: rec } = useQuery({
|
||||
queryKey: ["omni-recommendations"],
|
||||
queryFn: async () => {
|
||||
const r = await getOmniRecommendationsHome();
|
||||
if (r) {
|
||||
setRec(r);
|
||||
loadThumbnails(
|
||||
Object.entries(r.contentMetadata.Game).map((a) => ({
|
||||
type: "GameThumbnail",
|
||||
@@ -33,8 +33,11 @@ export default function Home() {
|
||||
}))
|
||||
).catch((a) => {});
|
||||
}
|
||||
}, 1000);
|
||||
}, []);
|
||||
return r;
|
||||
},
|
||||
staleTime: 300000, // 5 minutes
|
||||
refetchOnWindowFocus: false
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"use client";
|
||||
|
||||
export default function Page() {
|
||||
return <>
|
||||
hi
|
||||
</>
|
||||
return <>hi</>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user