Skip to content

Commit

Permalink
fix(product detail): avoid error in title. ref #55
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 24, 2023
1 parent e6465eb commit fcc0230
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/PriceCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</v-avatar>
</template>

<v-card-title>{{ product.product_name || price.product_code }}</v-card-title>
<v-card-title>{{ getPriceProductTitle(product, price) }}</v-card-title>

<v-card-subtitle>
<span v-if="product.brands">{{ product.brands }}</span>
Expand Down Expand Up @@ -52,6 +52,16 @@ export default {
let pricePerKilo = (priceValue / productQuantity) * 1000
return `${this.getPriceValueDisplay(pricePerKilo, priceCurrency)} / kg`
},
getPriceProductTitle(product, price) {
if (product && product.product_name) {
return product.product_name
} else if (price && price.product_code) {
return price.product_code
} else if (price && price.category_tag) {
return price.category_tag
}
return 'undefined'
},
getPriceLocationTitle(price) {
if (price.location) {
return `${price.location.osm_name}, ${price.location.osm_address_city}`
Expand Down

0 comments on commit fcc0230

Please sign in to comment.