Skip to content

Commit

Permalink
Merge pull request #291 from neontribe/1.7/make-spinner-async
Browse files Browse the repository at this point in the history
fix: spinner now blocks
  • Loading branch information
tobybatch authored Jul 4, 2023
2 parents df20c77 + bf30e9a commit 74653c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 7 additions & 12 deletions src/components/Account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,7 @@ export default {
selectedDate: null,
};
},
watch: {
voucherPayments: {
handler(newValue, oldValue) {
this.hideSpinner();
},
deep: true,
},
},
watch: {},
methods: {
recordSelect: function (event) {
this.selected = false;
Expand Down Expand Up @@ -312,23 +305,25 @@ export default {
? pg["current"].page + " of " + pg["last"].page
: "";
},
pgChangePage: function (event) {
pgChangePage: async function (event) {
this.showSpinner();
const key = event.target.id;
const pg = this.voucherPagination || {};
const page = pg.hasOwnProperty(key) ? pg[key].page : 1;
Store.getVoucherPaymentState(page);
await Store.getVoucherPaymentState(page);
this.hideSpinner();
},
},
mounted: function () {
mounted: async function () {
this.showSpinner();
Store.getVoucherPaymentState();
await Store.getVoucherPaymentState();
// TODO: Have a standard way of having global router messages.
const message = this.$router.message;
if (message) {
this.setMessage(message.text, message.state);
this.$router.message = {};
}
this.hideSpinner();
},
};
</script>
4 changes: 2 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ store.setLocalStorageFromUserTraders = function () {
*
* @param {int} [pageNum=1]
*/
store.getVoucherPaymentState = function (pageNum = 1) {
this.netMgr.apiGet(
store.getVoucherPaymentState = async function (pageNum = 1) {
await this.netMgr.apiGet(
`traders/${this.trader.id}/voucher-history?page=${pageNum}`,
(response) => {
// update the voucherPagination tracker
Expand Down

0 comments on commit 74653c5

Please sign in to comment.