crash fix
This commit is contained in:
parent
866628501c
commit
ff6ebb349e
@ -44,8 +44,8 @@ export default function AvatarStack({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function User({ pubkey, className }: { pubkey: string; className: string }) {
|
function User({ pubkey, className }: { pubkey: string; className: string }) {
|
||||||
const { profile } = useProfile(pubkey);
|
const { profile, npub } = useProfile(pubkey);
|
||||||
const npub = nip19.npubEncode(pubkey);
|
// const npub = profilenip19.npubEncode(pubkey);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Avatar
|
<Avatar
|
||||||
|
@ -7,7 +7,7 @@ import { type NDKUserProfile } from "@nostr-dev-kit/ndk";
|
|||||||
|
|
||||||
export default function useProfile(key: string) {
|
export default function useProfile(key: string) {
|
||||||
const { ndk, getProfile } = useNDK();
|
const { ndk, getProfile } = useNDK();
|
||||||
|
const npub = NOSTR_BECH32_REGEXP.test(key) ? nip19.npubEncode(key) : key;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ndk) return;
|
if (!ndk) return;
|
||||||
if (NOSTR_BECH32_REGEXP.test(key)) {
|
if (NOSTR_BECH32_REGEXP.test(key)) {
|
||||||
@ -20,5 +20,5 @@ export default function useProfile(key: string) {
|
|||||||
};
|
};
|
||||||
}, [key, ndk]);
|
}, [key, ndk]);
|
||||||
|
|
||||||
return { profile: getProfile(key) };
|
return { profile: getProfile(key), npub: npub };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user