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

33 lines
1005 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 Favorite Shows | ${TITLE}`,
description: `View your favorite shows on ${TITLE}. Keep track of films you’ve added and revisit your top picks anytime.`
};
const Favorites = async () => {
const session = cookies().get('session')?.value;
const queryClient = getQueryClient();
const list = 'favorite';
if (session) {
await queryClient.prefetchInfiniteQuery(usersShowsQuery({ showType: 'movie', session, list }));
}
return (
<HydrationBoundary state={dehydrate(queryClient)}>
<UsersList session={session} list={list} label='favorites' />
</HydrationBoundary>
);
};
export default Favorites;