This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import type { QueryClient } from "@tanstack/react-query";
|
||||
import {
|
||||
fetchAboutResponse,
|
||||
fetchCategoriesResponse,
|
||||
fetchFoodsResponse,
|
||||
} from "./serverMenuFetch";
|
||||
|
||||
export async function prefetchMenuPageData(
|
||||
queryClient: QueryClient,
|
||||
name: string,
|
||||
) {
|
||||
await Promise.all([
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ["about", name],
|
||||
queryFn: () => fetchAboutResponse(name),
|
||||
}),
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ["menu", name],
|
||||
queryFn: () => fetchFoodsResponse(name),
|
||||
}),
|
||||
queryClient.prefetchQuery({
|
||||
queryKey: ["categories", name],
|
||||
queryFn: () => fetchCategoriesResponse(name),
|
||||
}),
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user