mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-06 00:04:39 +00:00
fix: React Hook "useSWR" is called in function "fetchReleases" while build
This commit is contained in:
parent
6df90d5146
commit
4d1d923cd1
1 changed files with 9 additions and 9 deletions
18
app/page.js
18
app/page.js
|
@ -4,16 +4,16 @@ import { ReleaseCourusel } from "./components/ReleaseCourusel/ReleaseCourusel";
|
|||
import { Spinner } from "./components/Spinner/Spinner";
|
||||
const fetcher = (...args) => fetch(...args).then((res) => res.json());
|
||||
|
||||
function fetchReleases(status) {
|
||||
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
|
||||
return [data];
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
const [lastReleasesData] = fetchReleases("last");
|
||||
const [finishedReleasesData] = fetchReleases("finished");
|
||||
const [ongoingReleasesData] = fetchReleases("ongoing");
|
||||
const [announceReleasesData] = fetchReleases("announce");
|
||||
function useFetchReleases(status) {
|
||||
const { data } = useSWR(`/api/home?status=${status}`, fetcher);
|
||||
return [data];
|
||||
}
|
||||
|
||||
const [lastReleasesData] = useFetchReleases("last");
|
||||
const [finishedReleasesData] = useFetchReleases("finished");
|
||||
const [ongoingReleasesData] = useFetchReleases("ongoing");
|
||||
const [announceReleasesData] = useFetchReleases("announce");
|
||||
|
||||
return (
|
||||
<main className="flex flex-col pt-2 pb-16 sm:pt-4 sm:pb-0">
|
||||
|
|
Loading…
Add table
Reference in a new issue