Fix TypeScript build errors in product detail and admin review
This commit is contained in:
@ -168,7 +168,9 @@ function ProductDetailPageInner() {
|
||||
}, [errorLoadText, params.productId, isDraft, isReview]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!product?.subCategory?.id || product.subCategory.category?.name) {
|
||||
const subCategoryId = product?.subCategory?.id;
|
||||
|
||||
if (!subCategoryId || product?.subCategory?.category?.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -194,7 +196,7 @@ function ProductDetailPageInner() {
|
||||
const rows: CategoryOption[] = Array.isArray(subcategoriesJson?.rows)
|
||||
? subcategoriesJson.rows
|
||||
: [];
|
||||
if (rows.some((subCategory) => subCategory.id === product.subCategory?.id)) {
|
||||
if (rows.some((subCategory) => subCategory.id === subCategoryId)) {
|
||||
if (!cancelled) {
|
||||
setResolvedMainCategoryName(category.name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user