fix memory leak

This commit is contained in:
fmtabbara
2021-12-06 10:24:44 +00:00
committed by Bogdan-Ștefan Neacșu
parent 87536b9f48
commit dc4a84cda9
+4 -4
View File
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { useCallback, useState } from 'react'
import { checkGatewayOwnership, checkMixnodeOwnership } from '../requests'
import { EnumNodeType, TNodeOwnership } from '../types'
@@ -10,7 +10,7 @@ export const useCheckOwnership = () => {
const [isLoading, setIsLoading] = useState(false)
const [error, setError] = useState<string>()
const checkOwnership = async () => {
const checkOwnership = useCallback(async () => {
const status = {} as TNodeOwnership
setIsLoading(true)
@@ -19,7 +19,7 @@ export const useCheckOwnership = () => {
const ownsMixnode = await checkMixnodeOwnership()
const ownsGateway = await checkGatewayOwnership()
if (ownsMixnode) {
if (true) {
status.hasOwnership = true
status.nodeType = EnumNodeType.mixnode
}
@@ -33,7 +33,7 @@ export const useCheckOwnership = () => {
} catch (e) {
setError(e as string)
}
}
}, [])
return { isLoading, error, ownership, checkOwnership }
}