feat: changing API urls does not need the app refresh (#173)

* feat: changing API urls does not need the app refresh

* fix: propagate beeDebugApi and beeApi change to the refresh interval

* fix: any failed request on the Bee provider does not stop the execution of other requests

* fix: error handling for incorrect bee and bee debug urls

* fix: change debug API in the settings tab
This commit is contained in:
Vojtech Simetka
2021-08-20 15:14:14 +02:00
committed by GitHub
parent 2624cf04c9
commit d6d03bf7c6
21 changed files with 336 additions and 380 deletions
+9 -3
View File
@@ -1,10 +1,12 @@
import type { ReactElement } from 'react'
import { beeDebugApi } from '../services/bee'
import { ReactElement, useContext } from 'react'
import { Context as SettingsContext } from '../providers/Settings'
import WDModal from '../components/WDModal'
import { BigNumber } from 'bignumber.js'
export default function DepositModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
return (
<WDModal
successMessage="Successful deposit."
@@ -12,7 +14,11 @@ export default function DepositModal(): ReactElement {
dialogMessage="Specify the amount of BZZ you would like to withdraw from your node."
label="Deposit"
min={new BigNumber(0)}
action={beeDebugApi.chequebook.deposit}
action={(amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
return beeDebugApi.depositTokens(amount.toString())
}}
/>
)
}
+9 -3
View File
@@ -1,10 +1,12 @@
import type { ReactElement } from 'react'
import { beeDebugApi } from '../services/bee'
import { ReactElement, useContext } from 'react'
import { Context as SettingsContext } from '../providers/Settings'
import WDModal from '../components/WDModal'
import { BigNumber } from 'bignumber.js'
export default function WithdrawModal(): ReactElement {
const { beeDebugApi } = useContext(SettingsContext)
return (
<WDModal
successMessage="Successful withdrawl."
@@ -12,7 +14,11 @@ export default function WithdrawModal(): ReactElement {
dialogMessage="Specify the amount of BZZ you would like to withdraw from your node."
label="Withdraw"
min={new BigNumber(0)}
action={beeDebugApi.chequebook.withdraw}
action={(amount: bigint) => {
if (!beeDebugApi) throw new Error('Bee Debug URL is not valid')
return beeDebugApi.withdrawTokens(amount.toString())
}}
/>
)
}