export const Route = createFileRoute(
'/$locale/_layout/(main)/_main/product/$handle'
)({
beforeLoad: async ({ params: { handle }, context: { region } }) => {
const product = await queryClient.fetchQuery(
getProductByHandleQueryOptions({ handle, region_id: region.id })
);
if (!product) {
throw notFound({
routeId: Route.id,
data: { handle },
});
}
return { product };
},
component: ProductTemplate,
});
export const Route = createFileRoute(
'/$locale/_layout/(main)/_main/product/$handle'
)({
beforeLoad: async ({ params: { handle }, context: { region } }) => {
const product = await queryClient.fetchQuery(
getProductByHandleQueryOptions({ handle, region_id: region.id })
);
if (!product) {
throw notFound({
routeId: Route.id,
data: { handle },
});
}
return { product };
},
component: ProductTemplate,
});