Files
movie-advisor/app/(site)/watch-list/page.tsx
T
2024-11-03 19:22:19 +02:00

33 lines
998 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
import { Metadata } from 'next';
import { cookies } from 'next/headers';
import UsersList from '@/components/UsersLists';
import usersShowsQuery from '@/data/queries/usersShows';
import { TITLE } from '@/env';
import getQueryClient from '@/lib/queryClient';
export const metadata: Metadata = {
title: `My watch list | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`
};
const WatchList = async () => {
const session = cookies().get('session')?.value;
const queryClient = getQueryClient();
const list = 'watchlist';
if (session) {
await queryClient.prefetchInfiniteQuery(usersShowsQuery({ showType: 'movie', session, list }));
}
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<UsersList session={session} list={list} label='watch' />
</HydrationBoundary>
);
};
export default WatchList;