#84 refactor(frontend): summaryPurchase moved to repository.
This commit is contained in:
parent
fcb83d05fb
commit
8f9917c3a4
@ -47,6 +47,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { inject } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SummaryPurchase',
|
name: 'SummaryPurchase',
|
||||||
props: {
|
props: {
|
||||||
@ -55,6 +57,7 @@
|
|||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
api: inject('api'),
|
||||||
purchase: {},
|
purchase: {},
|
||||||
headers: [
|
headers: [
|
||||||
{ title: 'Producto', value: 'product.name' },
|
{ title: 'Producto', value: 'product.name' },
|
||||||
@ -73,8 +76,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchPurchase(purchaseId) {
|
fetchPurchase(purchaseId) {
|
||||||
fetch(`/don_confiao/resumen_compra_json/${purchaseId}`)
|
this.api.getSummaryPurchase(purchaseId)
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.purchase = data;
|
this.purchase = data;
|
||||||
})
|
})
|
||||||
|
@ -15,6 +15,10 @@ class Api {
|
|||||||
return this.apiImplementation.getPaymentMethods();
|
return this.apiImplementation.getPaymentMethods();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSummaryPurchase(purchaseId) {
|
||||||
|
return this.apiImplementation.getSummaryPurchase(purchaseId);
|
||||||
|
}
|
||||||
|
|
||||||
createPurchase(purchase) {
|
createPurchase(purchase) {
|
||||||
return this.apiImplementation.createPurchase(purchase);
|
return this.apiImplementation.createPurchase(purchase);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,19 @@ class DjangoApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSummaryPurchase(purchaseId) {
|
||||||
|
return new Promise ((resolve, reject) => {
|
||||||
|
fetch(`/don_confiao/resumen_compra_json/${purchaseId}`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
resolve(data);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
createPurchase(purchase) {
|
createPurchase(purchase) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log('compra a enviar:', purchase);
|
console.log('compra a enviar:', purchase);
|
||||||
|
Loading…
Reference in New Issue
Block a user