This commit is contained in:
marzban-dev
2025-02-02 21:21:13 +03:30
parent cacbbc0310
commit ddf4e813e3
+10 -12
View File
@@ -9,22 +9,20 @@ const route = useRoute();
const id = route.params.id as string | undefined; const id = route.params.id as string | undefined;
const page = ref(1); const page = ref(1);
const { suspense : suspenseProduct } = useGetProduct(id); const { suspense: suspenseProduct } = useGetProduct(id);
const { suspense : suspenseComments} = useGetComments(id, page); const { suspense: suspenseComments } = useGetComments(id, page);
// ssr // ssr
await useAsyncData(async () => { const productResponse = await suspenseProduct();
const productResponse = await suspenseProduct(); const commentsResponse = await suspenseComments();
const commentsResponse = await suspenseComments();
if (productResponse.isError || commentsResponse.isError) { if (productResponse.isError || commentsResponse.isError) {
throw createError({ throw createError({
statusCode: 404, statusCode: 404,
statusMessage: `error : product ${id} prefetch error` statusMessage: `error : product ${id} prefetch error`
}); });
} }
});
</script> </script>