From 86edd907f4ede010835908e3f5bc6388c64e1f9e Mon Sep 17 00:00:00 2001 From: omair saleh Date: Tue, 15 Sep 2020 13:05:19 +0800 Subject: [PATCH] fixed bank details not showing bug --- .../js/pages/booking/uploadUserBankSlip.vue | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/resources/assets/js/pages/booking/uploadUserBankSlip.vue b/resources/assets/js/pages/booking/uploadUserBankSlip.vue index d4fac2c3..03d66ab4 100644 --- a/resources/assets/js/pages/booking/uploadUserBankSlip.vue +++ b/resources/assets/js/pages/booking/uploadUserBankSlip.vue @@ -264,46 +264,47 @@ name: 'home' }) } - }).catch((error) => { + }).then(() => { + axios.get('/api/active-bank') + .then((response) => { + this.active_bank_setting = response.data; + var url = ''; + if (this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' || this.booking.term === 'x1_ba') { + url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id; + } else if (this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' || this.booking.term === 'x2_ba') { + url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id; + } + + axios.get(url) + .then((response) => { + this.bankDetail = response.data; + loading.close() + }) + .catch((error) => { + loading.close() + console.log(error); + this.$message({ + showClose: true, + message: 'Fetch data fail', + type: 'error', + duration: 10000 + }); + }); + }) + .catch((error) => { + console.log(error); + this.$message({ + showClose: true, + message: 'Fetch bank details fail', + type: 'error', + duration: 10000 + }); + }); + }).catch((error) => { this.$router.push({ name: 'notfound' }) console.log(error) - }) - axios.get('/api/active-bank') - .then((response) => { - this.active_bank_setting = response.data; - var url = ''; - if (this.booking.term === 'x1_cash' || this.booking.term === 'x1_cheque' || this.booking.term === 'x1_ba') { - url = '/api/malaysia-bank/' + this.active_bank_setting.x1_bank_id; - } else if (this.booking.term === 'x2_cash' || this.booking.term === 'x2_cheque' || this.booking.term === 'x2_ba') { - url = '/api/malaysia-bank/' + this.active_bank_setting.x2_bank_id; - } - - axios.get(url) - .then((response) => { - this.bankDetail = response.data; - loading.close() - }) - .catch((error) => { - loading.close() - console.log(error); - this.$message({ - showClose: true, - message: 'Fetch data fail', - type: 'error', - duration: 10000 - }); - }); - }) - .catch((error) => { - console.log(error); - this.$message({ - showClose: true, - message: 'Fetch bank details fail', - type: 'error', - duration: 10000 - }); }); }, methods: {