refactor: debug api connection - ping peer method

This commit is contained in:
Vojtech Simetka
2021-04-02 10:50:40 +02:00
parent 53dd4e1741
commit f949bdffc6
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import type { NodeAddresses, ChequebookAddressResponse, ChequebookBalanceResponse, BalanceResponse,
LastChequesResponse, AllSettlements, LastCashoutActionResponse, Health, Peer, Topology } from '@ethersphere/bee-js'
LastChequesResponse, AllSettlements, LastCashoutActionResponse, Health, Peer, Topology, PingResponse } from '@ethersphere/bee-js'
import { beeDebugApi, beeApi } from '../services/bee';
@@ -258,7 +258,7 @@ export const useApiSettlements = () => {
export const useApiPingPeer = (peerId: string) => {
const [peerRTP, setPeerRTP] = useState<string>('')
const [peerRTP, setPeerRTP] = useState<PingResponse | null>()
const [isPingingPeer, setPingingPeer] = useState<boolean>(false)
const [error, setError] = useState<Error | null>(null)
@@ -266,7 +266,7 @@ export const useApiPingPeer = (peerId: string) => {
setPingingPeer(true)
beeDebugApi.connectivity.ping(peerId)
.then(res => {
setPeerRTP(res.data)
setPeerRTP(res)
})
.catch(error => {
setError(error)
+1 -1
View File
@@ -29,7 +29,7 @@ function PeerTable(props: Props) {
setPeerLatency([...peerLatency, { peerId: peerId, rtt: '', loading: true }])
beeDebugApi.connectivity.ping(peerId)
.then(res => {
setPeerLatency([...peerLatency, { peerId: peerId, rtt: res.data.rtt, loading: false }])
setPeerLatency([...peerLatency, { peerId: peerId, rtt: res.rtt, loading: false }])
})
.catch(error => {
setPeerLatency([...peerLatency, { peerId: peerId, rtt: 'error', loading: false }])
+1 -1
View File
@@ -66,7 +66,7 @@ export const beeDebugApi = {
return beeJSDebugClient().getTopology()
},
ping(peerId: string) {
return beeDebugApiClient().post(`/pingpong/${peerId}`)
return beeJSDebugClient().pingPeer(peerId)
}
},
balance: {