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