prefetchQuery customer profile pages
This commit is contained in:
parent
f6285d6ebf
commit
1b1963e5d9
@ -1,3 +1,4 @@
|
||||
import { getCustomer } from '@/actions/api/customers';
|
||||
import { Container } from '@/components/layout';
|
||||
import { PageHeader } from '@/components/navigation';
|
||||
import { ContactDataCard, PersonCard } from '@/components/profile';
|
||||
@ -11,6 +12,11 @@ export default async function ProfilePage(props: Readonly<Props>) {
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
queryFn: () => getCustomer({ telegramId }),
|
||||
queryKey: ['customer', telegramId],
|
||||
});
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<PageHeader title="Профиль контакта" />
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { getCustomer } from '@/actions/api/customers';
|
||||
import { getSessionUser } from '@/actions/session';
|
||||
import { Container } from '@/components/layout';
|
||||
import { LinksCard, PersonCard, ProfileDataCard } from '@/components/profile';
|
||||
import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query';
|
||||
@ -5,6 +7,13 @@ import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query
|
||||
export default async function ProfilePage() {
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
const { telegramId } = await getSessionUser();
|
||||
|
||||
await queryClient.prefetchQuery({
|
||||
queryFn: () => getCustomer({ telegramId }),
|
||||
queryKey: ['customer', telegramId],
|
||||
});
|
||||
|
||||
return (
|
||||
<HydrationBoundary state={dehydrate(queryClient)}>
|
||||
<Container className="px-0">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user