cambios para que cargue los productos
This commit is contained in:
parent
b2a52dd216
commit
4ae0de0548
|
@ -98,7 +98,7 @@ class ProductController {
|
||||||
const { dateExpired, postalCode } = req.query
|
const { dateExpired, postalCode } = req.query
|
||||||
const id = Number(req.params.id)
|
const id = Number(req.params.id)
|
||||||
const _products = await db.getProducts(dateExpired, postalCode);
|
const _products = await db.getProducts(dateExpired, postalCode);
|
||||||
const filterProduct = _products[0].filter(item => item.id === id)
|
const filterProduct = _products[0].filter(item => item.itemFk === id)
|
||||||
|
|
||||||
return res.status(200).send({
|
return res.status(200).send({
|
||||||
data: filterProduct
|
data: filterProduct
|
||||||
|
|
|
@ -275,14 +275,14 @@ export default defineComponent({
|
||||||
|
|
||||||
<div class="products-section-body">
|
<div class="products-section-body">
|
||||||
<Container cardContainer class="category-container">
|
<Container cardContainer class="category-container">
|
||||||
<template v-for="item in products.data" :key="item?.id">
|
<template v-for="item in products.data" :key="item?.itemFk">
|
||||||
<Card
|
<Card
|
||||||
v-if="item"
|
v-if="item"
|
||||||
:price="item.price"
|
:price="item.price"
|
||||||
:title="item.name"
|
:title="item.name"
|
||||||
:imgSrc="item.image"
|
:imgSrc="item.image"
|
||||||
:isNew="item.isNew"
|
:isNew="item.isNew"
|
||||||
:id="item.id"
|
:id="item.itemFk"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
@ -190,9 +190,9 @@ export default defineComponent({
|
||||||
<p class="product-content-paragraph">
|
<p class="product-content-paragraph">
|
||||||
SKU:
|
SKU:
|
||||||
<span class="green-text" style="display: inline-flex">
|
<span class="green-text" style="display: inline-flex">
|
||||||
{{ products.current?.id }}
|
{{ products.current?.itemFk }}
|
||||||
<q-skeleton
|
<q-skeleton
|
||||||
v-if="!products.current?.id"
|
v-if="!products.current?.itemFk"
|
||||||
width="100px"
|
width="100px"
|
||||||
type="text"
|
type="text"
|
||||||
/>
|
/>
|
||||||
|
@ -303,7 +303,7 @@ export default defineComponent({
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="products.next?.id"
|
v-if="products.next?.itemFk"
|
||||||
color="white"
|
color="white"
|
||||||
class="btn outlined rounded sm-btn product-pag-item product-next-btn"
|
class="btn outlined rounded sm-btn product-pag-item product-next-btn"
|
||||||
:to="`${+$route.params.id + 1}`"
|
:to="`${+$route.params.id + 1}`"
|
||||||
|
|
|
@ -197,7 +197,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
await getProducts(params);
|
await getProducts(params);
|
||||||
|
|
||||||
const hasCurrentProduct = computed(() => {
|
const hasCurrentProduct = computed(() => {
|
||||||
return cart.value.find((p) => p.id === product.id);
|
return cart.value.find((p) => p.itemFk === product.itemFk);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isEmpty.value) {
|
if (isEmpty.value) {
|
||||||
|
@ -209,7 +209,7 @@ export const useCartStore = defineStore("cart", () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!products.value.data.some((item) => item.id === product.id)) {
|
if (!products.value.data.some((item) => item.itemFk === product.itemFk)) {
|
||||||
push("/");
|
push("/");
|
||||||
return quasarNotify({
|
return quasarNotify({
|
||||||
message:
|
message:
|
||||||
|
|
Loading…
Reference in New Issue