refactor: debug api health to use bee-js and removed node readiness (#41)

This commit is contained in:
Vojtech Simetka
2021-04-02 15:20:51 +02:00
committed by GitHub
parent decdd87bb7
commit c88027cc38
4 changed files with 24 additions and 67 deletions
+12 -5
View File
@@ -1,5 +1,5 @@
import axios, { AxiosInstance } from 'axios';
import { Bee, Reference } from "@ethersphere/bee-js";
import { Bee, BeeDebug, Reference } from "@ethersphere/bee-js";
const beeJSClient = () => {
let apiHost = process.env.REACT_APP_BEE_HOST || 'http://localhost:1633'
@@ -11,6 +11,16 @@ const beeJSClient = () => {
return new Bee(apiHost)
}
const beeJSDebugClient = () => {
let debugApiHost = process.env.REACT_APP_BEE_DEBUG_HOST || 'http://localhost:1635'
if (sessionStorage.getItem('debug_api_host')) {
debugApiHost = String(sessionStorage.getItem('debug_api_host'))
}
return new BeeDebug(debugApiHost)
}
const beeDebugApiClient = (): AxiosInstance => {
let debugApiHost = process.env.REACT_APP_BEE_DEBUG_HOST || 'http://localhost:1635'
@@ -42,10 +52,7 @@ export const beeApi = {
export const beeDebugApi = {
status: {
nodeHealth() {
return beeDebugApiClient().get(`/health`)
},
nodeReadiness() {
return beeDebugApiClient().get(`/readiness`)
return beeJSDebugClient().getHealth()
},
},
connectivity: {