refactor: use bee-js for health endpoint (#38)

* refactor: use bee-js for health endpoint

* refactor: fix API URLs which could be undefined
This commit is contained in:
Vojtech Simetka
2021-04-01 18:20:27 +02:00
committed by GitHub
parent 0e4e9bcf68
commit decdd87bb7
3 changed files with 15 additions and 37 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import type { NodeAddresses, ChequebookAddressResponse, ChequebookBalanceRespons
import { beeDebugApi, beeApi } from '../services/bee';
export const useApiHealth = () => {
const [health, setHealth] = useState('')
const [health, setHealth] = useState<boolean>(false)
const [isLoadingHealth, setLoading] = useState<boolean>(false)
const [error, setError] = useState<Error | null>(null)
@@ -14,7 +14,7 @@ export const useApiHealth = () => {
setLoading(true)
beeApi.status.health()
.then(res => {
setHealth(res.data)
setHealth(res)
})
.catch(error => {
setError(error)