refactor: remove electron-related code
This commit is contained in:
parent
bed8df06e8
commit
2b1e6fe8f5
200 changed files with 2771 additions and 8432 deletions
23
src/hooks/useFetchRelayList.tsx
Normal file
23
src/hooks/useFetchRelayList.tsx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { TRelayList } from '@/types'
|
||||
import { useEffect, useState } from 'react'
|
||||
import client from '@/services/client.service'
|
||||
|
||||
export function useFetchRelayList(pubkey?: string | null) {
|
||||
const [relayList, setRelayList] = useState<TRelayList>({ write: [], read: [] })
|
||||
|
||||
useEffect(() => {
|
||||
const fetchRelayList = async () => {
|
||||
if (!pubkey) return
|
||||
try {
|
||||
const relayList = await client.fetchRelayList(pubkey)
|
||||
setRelayList(relayList)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
fetchRelayList()
|
||||
}, [pubkey])
|
||||
|
||||
return relayList
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue