rome -> eslint + prettier

This commit is contained in:
Ren Amamiya
2023-07-04 13:24:42 +07:00
parent 744fbd5683
commit a30cf66c2e
187 changed files with 10179 additions and 10066 deletions

View File

@@ -1,33 +1,33 @@
import { NDKUser } from "@nostr-dev-kit/ndk";
import { RelayContext } from "@shared/relayProvider";
import { useQuery } from "@tanstack/react-query";
import { useContext } from "react";
import { useQuery } from '@tanstack/react-query';
import { useContext } from 'react';
import { RelayContext } from '@shared/relayProvider';
export function useProfile(pubkey: string, fallback?: string) {
const ndk = useContext(RelayContext);
const {
status,
data: user,
error,
isFetching,
} = useQuery(
["user", pubkey],
async () => {
if (fallback) {
const profile = JSON.parse(fallback);
return profile;
} else {
const user = ndk.getUser({ hexpubkey: pubkey });
await user.fetchProfile();
const ndk = useContext(RelayContext);
const {
status,
data: user,
error,
isFetching,
} = useQuery(
['user', pubkey],
async () => {
if (fallback) {
const profile = JSON.parse(fallback);
return profile;
} else {
const user = ndk.getUser({ hexpubkey: pubkey });
await user.fetchProfile();
return user.profile;
}
},
{
refetchOnWindowFocus: false,
refetchOnReconnect: false,
},
);
return user.profile;
}
},
{
refetchOnWindowFocus: false,
refetchOnReconnect: false,
}
);
return { status, user, error, isFetching };
return { status, user, error, isFetching };
}