From cbd65eb6c8243868635df816e39c10092761b5ea Mon Sep 17 00:00:00 2001 From: Muhammad Fadli Date: Fri, 21 Apr 2023 11:20:56 +0700 Subject: [PATCH 1/2] - push logs --- src/helper/irs-api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 0349e3e..96167d9 100644 --- a/src/helper/irs-api.ts +++ b/src/helper/irs-api.ts @@ -126,8 +126,8 @@ export const doTransaction = async ( 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); + return res.data; } catch (e) { throw 'maaf saat ini transaksi sedang tidak bisa diproses, silahkan hubungi WND Solutions untuk bisa di proses kembali'; } From de3ce1adab37d770bb377164417ea6a950781591 Mon Sep 17 00:00:00 2001 From: Muhammad Fadli Date: Fri, 21 Apr 2023 11:26:59 +0700 Subject: [PATCH 2/2] - push logs --- src/helper/irs-api.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/helper/irs-api.ts b/src/helper/irs-api.ts index 96167d9..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}`, - ); - console.log('restranshemat', res); - return res.data; - } 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);