feat: refresh wallet on buy
This commit is contained in:
parent
e4f9341e5d
commit
135beb5238
|
@ -1,7 +1,7 @@
|
||||||
import { observable, action, computed } from 'mobx';
|
import { observable, action, computed } from 'mobx';
|
||||||
|
|
||||||
export default class Vouchers {
|
export default class Vouchers {
|
||||||
|
|
||||||
@observable list = [];
|
@observable list = [];
|
||||||
@observable selected = {};
|
@observable selected = {};
|
||||||
@observable istLoading = false;
|
@observable istLoading = false;
|
||||||
|
@ -21,7 +21,7 @@ export default class Vouchers {
|
||||||
this.http = context.http;
|
this.http = context.http;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
getList(){
|
getList(){
|
||||||
console.log('res');
|
console.log('res');
|
||||||
|
@ -49,18 +49,18 @@ export default class Vouchers {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
buyVoucher(data){
|
buyVoucher(data){
|
||||||
console.log('data',data)
|
console.log('data',data)
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
return this.http.post("shop/buy_voucher", {
|
return this.http.post("shop/buy_voucher", {
|
||||||
item_sku_id : data
|
item_sku_id : data
|
||||||
}
|
}).then(res => {
|
||||||
).then(res => {
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
this.context.wallet.getData();
|
||||||
console.log('res',res)
|
console.log('res',res)
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
|
@ -69,7 +69,7 @@ export default class Vouchers {
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
put(id,data){
|
put(id,data){
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@ -84,7 +84,7 @@ export default class Vouchers {
|
||||||
throw err;
|
throw err;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
delete(id){
|
delete(id){
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
@ -102,7 +102,7 @@ export default class Vouchers {
|
||||||
|
|
||||||
filterItems = (query) => {
|
filterItems = (query) => {
|
||||||
return this.list.filter((el) =>
|
return this.list.filter((el) =>
|
||||||
el.name.toLowerCase().indexOf(query.toLowerCase()) > -1
|
el.name.toLowerCase().indexOf(query.toLowerCase()) > -1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user