feat: update rust nostr
This commit is contained in:
@@ -6,7 +6,7 @@ export function useEvent(id: string) {
|
||||
const { isLoading, isError, data } = useQuery({
|
||||
queryKey: ["event", id],
|
||||
queryFn: async () => {
|
||||
const event = await ark.getEventById(id);
|
||||
const event = await ark.get_event(id);
|
||||
if (!event)
|
||||
throw new Error(
|
||||
`Cannot get event with ${id}, will be retry after 10 seconds`,
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { NDKUserProfile } from "@nostr-dev-kit/ndk";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useArk } from "./useArk";
|
||||
|
||||
export function useProfile(pubkey: string) {
|
||||
const ark = useArk();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const {
|
||||
isLoading,
|
||||
isError,
|
||||
@@ -13,16 +10,13 @@ export function useProfile(pubkey: string) {
|
||||
} = useQuery({
|
||||
queryKey: ["user", pubkey],
|
||||
queryFn: async () => {
|
||||
const profile = await ark.getUserProfile(pubkey);
|
||||
const profile = await ark.get_metadata(pubkey);
|
||||
if (!profile)
|
||||
throw new Error(
|
||||
`Cannot get metadata for ${pubkey}, will be retry after 10 seconds`,
|
||||
);
|
||||
return profile;
|
||||
},
|
||||
initialData: () => {
|
||||
return queryClient.getQueryData(["user", pubkey]) as NDKUserProfile;
|
||||
},
|
||||
refetchOnMount: false,
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
|
||||
Reference in New Issue
Block a user