Skip to content

Commit

Permalink
fix network type change in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner committed Nov 22, 2024
1 parent c2df695 commit defc231
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/next/src/hooks/useNetwork.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { networks } from '@autonomys/auto-utils'
import { NetworkId, networks } from '@autonomys/auto-utils'
import { useParams } from 'next/navigation'
import { useCallback, useEffect, useMemo, useState } from 'react'

Expand All @@ -17,7 +17,7 @@ export const useNetwork = () => {
const listOfNetworks = useMemo(() => networks.map((network) => network.id), [])

const handleNetworkChange = useCallback(
(networkId: string) => {
(networkId: NetworkId) => {
if (!listOfNetworks.includes(networkId)) {
throw new Error(`Network ${networkId} not found`)
}
Expand All @@ -29,7 +29,7 @@ export const useNetwork = () => {

useEffect(() => {
if (networkName && config.networkId !== networkName && Array.isArray(networkName) === false)
handleNetworkChange(networkName)
handleNetworkChange(networkName as NetworkId)
}, [networkName])

return { config, handleNetworkChange }
Expand Down

0 comments on commit defc231

Please sign in to comment.