WIP MMCM
This commit is contained in:
@@ -56,7 +56,7 @@ export default {
|
|||||||
},
|
},
|
||||||
checkIdAddressIsEligible: async function () {
|
checkIdAddressIsEligible: async function () {
|
||||||
|
|
||||||
const urlApi = '/php/api/v3/mmcm.php?street=' + encodeURI(this.store.street)
|
const urlApi = '/php/api/v3/mmcm.php?EXEC=getEligibility&street=' + encodeURI(this.store.street)
|
||||||
+ '&zip_code=' + this.store.zipCode
|
+ '&zip_code=' + this.store.zipCode
|
||||||
+ '&city=' + this.store.city
|
+ '&city=' + this.store.city
|
||||||
|
|
||||||
@@ -68,6 +68,8 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log(productList);
|
||||||
|
|
||||||
this.store.setProductList(productList);
|
this.store.setProductList(productList);
|
||||||
this.$router.push({path: '/delivery-option'});
|
this.$router.push({path: '/delivery-option'});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<div v-for="product in store.productList" class="card">
|
<div v-for="product in store.productList" class="card">
|
||||||
<div class="card-header">{{ product.name }}</div>
|
<div class="card-header">{{ product.name }}</div>
|
||||||
<div class="card-body">{{ product.price }}</div>
|
<div class="card-body">{{ product.price }}</div>
|
||||||
|
<button @click="addToCart(product.id)">Ajouter au panier</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@@ -17,7 +19,24 @@ export default {
|
|||||||
store
|
store
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
name: "delivery-option"
|
name: "delivery-option",
|
||||||
|
methods: {
|
||||||
|
addToCart: async function (idProduct) {
|
||||||
|
console.log(this.store.productList)
|
||||||
|
const urlApi = '/php/api/v3/mmcm.php?EXEC=addToCart&ID_PRODUCT=' + idProduct;
|
||||||
|
console.log(urlApi)
|
||||||
|
|
||||||
|
const result = await fetch(urlApi)
|
||||||
|
.then(response => {
|
||||||
|
if (response.ok) {
|
||||||
|
return response.json();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(result)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user