refactoring: server actions data fetching -> api routes

This commit is contained in:
ner committed 2024-10-26 21:33:39 +03:00
1 parent 1111712d2c
commit 5cbf93b3b8
38 files changed
+326 -308

No files matched your search

+2 -6
View File
@@ -1,7 +1,7 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import { popularMovies } from '@/api';
import popularQuery from '@/api/queries/popular';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
@@ -15,11 +15,7 @@ export const metadata: Metadata = {
const Popular = () => {
const queryClient = getQueryClient();
queryClient.prefetchInfiniteQuery({
queryKey: ['popular'],
queryFn: () => popularMovies(),
initialPageParam: '1'
});
queryClient.prefetchInfiniteQuery(popularQuery());
return (
<HydrationBoundary state={dehydrate(queryClient)}>