diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 0349e3e..125507f 100644 --- a/src/helper/irs-api.ts +++ b/src/helper/irs-api.ts @@ -122,15 +122,20 @@ export const doTransaction = async ( } } - try { const res = await axios.get( `${supplier.url}?memberID=${supplier.irs_id}&pin=${supplier.irs_pin}&password=${supplier.irs_pass}&product=${productCode}&dest=${destination}&counter=1&refID=${idtrx}`, - ); - return res.data; - console.log('restranshemat', res); - } catch (e) { - throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; - } + ) + .catch((error) => { + if (error.response) { + throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; + } else if (error.request) { + throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; + } else { + throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; + } + }); + + return res.data; } catch (err) { console.log('errtransaction', err);