From a5c1f1db7493084610de28d2bc2a32f1b69415a2 Mon Sep 17 00:00:00 2001 From: en Date: Mon, 3 Feb 2025 17:02:21 +0100 Subject: [PATCH] refactor(useProfile): add opts to hook --- src/hooks/useProfile.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hooks/useProfile.tsx b/src/hooks/useProfile.tsx index 15f00ff..26508bb 100644 --- a/src/hooks/useProfile.tsx +++ b/src/hooks/useProfile.tsx @@ -1,18 +1,19 @@ +import { NDKSubscriptionOptions } from '@nostr-dev-kit/ndk' import { useNDKContext } from 'hooks' import { useState, useEffect } from 'react' import { UserProfile } from 'types' -export const useProfile = (pubkey?: string) => { +export const useProfile = (pubkey?: string, opts?: NDKSubscriptionOptions) => { const { findMetadata } = useNDKContext() const [profile, setProfile] = useState() useEffect(() => { if (pubkey) { - findMetadata(pubkey).then((res) => { + findMetadata(pubkey, opts).then((res) => { setProfile(res) }) } - }, [findMetadata, pubkey]) + }, [findMetadata, pubkey, opts]) return profile }