diff --git a/web/satellite/src/api/payments.ts b/web/satellite/src/api/payments.ts index 2c6dc9ffb..2a768219e 100644 --- a/web/satellite/src/api/payments.ts +++ b/web/satellite/src/api/payments.ts @@ -273,7 +273,12 @@ export class PaymentsHttpApi implements PaymentsApi { const path = `${this.ROOT_PATH}/wallet/payments`; const response = await this.client.get(path); + const json = await response.json(); if (!response.ok) { + if (json.error.includes('wallet does not exist')) { + // wallet does not exist automatically means that there are no payments + return []; + } throw new APIError({ status: response.status, message: 'Can not list token payment history', @@ -281,7 +286,6 @@ export class PaymentsHttpApi implements PaymentsApi { }); } - const json = await response.json(); if (!json) return []; if (json.payments) { return json.payments.map(item => @@ -311,11 +315,15 @@ export class PaymentsHttpApi implements PaymentsApi { const path = `${this.ROOT_PATH}/wallet/payments-with-confirmations`; const response = await this.client.get(path); + const json = await response.json(); if (!response.ok) { + if (json.error.includes('wallet does not exist')) { + // wallet does not exist automatically means that there are no payments + return []; + } throw new Error('Can not list token payment with confirmations'); } - const json = await response.json(); if (json && json.length) { return json.map(item => new PaymentWithConfirmations(