feat: refresh wallet on buy

This commit is contained in:
Hasta Ragil Saputra 2019-01-29 19:47:46 +07:00
parent e4f9341e5d
commit 135beb5238

View File

@ -1,7 +1,7 @@
import { observable, action, computed } from 'mobx';
export default class Vouchers {
@observable list = [];
@observable selected = {};
@observable istLoading = false;
@ -21,7 +21,7 @@ export default class Vouchers {
this.http = context.http;
this.context = context;
}
@action
getList(){
console.log('res');
@ -49,18 +49,18 @@ export default class Vouchers {
this.isLoading = false;
throw err;
})
}
}
@action
buyVoucher(data){
console.log('data',data)
this.isLoading = true;
return this.http.post("shop/buy_voucher", {
item_sku_id : data
}
).then(res => {
}).then(res => {
this.isLoading = false;
this.getList();
this.getList();
this.context.wallet.getData();
console.log('res',res)
return res;
})
@ -69,7 +69,7 @@ export default class Vouchers {
throw err;
})
}
@action
put(id,data){
this.isLoading = true;
@ -84,7 +84,7 @@ export default class Vouchers {
throw err;
})
}
@action
delete(id){
this.isLoading = true;
@ -102,7 +102,7 @@ export default class Vouchers {
filterItems = (query) => {
return this.list.filter((el) =>
el.name.toLowerCase().indexOf(query.toLowerCase()) > -1
el.name.toLowerCase().indexOf(query.toLowerCase()) > -1
);
}