feat: favorite & watch lists

This commit is contained in:
ner committed 2024-10-19 16:09:15 +03:00
1 parent 960a7a6242
commit 8858e47d38
51 files changed
+561 -290

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
'use client';
import UsersList from '@/components/UsersLists';
const Container = () => <UsersList list='watchlist' label='watch' />;
export default Container;
+34
View File
@@ -0,0 +1,34 @@
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import { usersShows } from '@/api';
import getQueryClient from '@/lib/queryClient';
import Container from './container';
export const metadata: Metadata = {
title: 'My watch list - Movie Advisor',
description:
'View your favorite shows on Movie Advisor. Keep track of films you’ve added and revisit your top picks anytime.'
};
const WatchList = async () => {
const queryClient = getQueryClient();
const list = 'watchlist';
const showType = 'movie';
await queryClient.prefetchInfiniteQuery({
queryKey: [`users-${list}`, showType],
queryFn: () => usersShows({ showType, list }),
initialPageParam: '1'
});
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<Container />
</HydrationBoundary>
);
};
export default WatchList;