multiple zapping issues resolved for confirming and showing active states of zaps #36
@ -121,10 +121,10 @@ export class MetadataController {
|
|||||||
public findUserRelays = async (
|
public findUserRelays = async (
|
||||||
hexKey: string,
|
hexKey: string,
|
||||||
userRelaysType: UserRelaysType = UserRelaysType.Both
|
userRelaysType: UserRelaysType = UserRelaysType.Both
|
||||||
) => {
|
): Promise<string[]> => {
|
||||||
log(true, LogType.Info, `ℹ Finding user's relays`, hexKey, userRelaysType)
|
log(true, LogType.Info, `ℹ Finding user's relays`, hexKey, userRelaysType)
|
||||||
|
|
||||||
const ndkRelayListPromise = await getRelayListForUser(hexKey, this.ndk)
|
const ndkRelayListPromise = getRelayListForUser(hexKey, this.ndk)
|
||||||
|
|
||||||
// Use Promise.race to either get the NDKRelayList instance or handle the timeout
|
// Use Promise.race to either get the NDKRelayList instance or handle the timeout
|
||||||
return await Promise.race([
|
return await Promise.race([
|
||||||
@ -132,11 +132,12 @@ export class MetadataController {
|
|||||||
timeout() // Custom timeout function that rejects after a specified time
|
timeout() // Custom timeout function that rejects after a specified time
|
||||||
])
|
])
|
||||||
.then((ndkRelayList) => {
|
.then((ndkRelayList) => {
|
||||||
return ndkRelayList[userRelaysType]
|
if (ndkRelayList) return ndkRelayList[userRelaysType]
|
||||||
|
return [] // Return an empty array if ndkRelayList is undefined
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
log(true, LogType.Error, err)
|
log(true, LogType.Error, err)
|
||||||
return [] as string[] // Return an empty array if an error occurs
|
return [] // Return an empty array if an error occurs
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user