feat: group metadata query

This commit is contained in:
reya
2024-10-29 15:05:03 +07:00
parent d87371aec4
commit 11dcef4e87
23 changed files with 323 additions and 169 deletions
+9 -8
View File
@@ -2,26 +2,27 @@ import { useProfile } from "@/system";
import type { Metadata } from "@/types";
import { type ReactNode, createContext, useContext } from "react";
const UserContext = createContext<{
interface UserContext {
pubkey: string;
profile: Metadata;
isError: boolean;
profile: Metadata | undefined;
isLoading: boolean;
}>(null);
}
const UserContext = createContext<UserContext | null>(null);
export function UserProvider({
pubkey,
children,
embedProfile,
data,
}: {
pubkey: string;
children: ReactNode;
embedProfile?: string;
data?: string;
}) {
const { isLoading, isError, profile } = useProfile(pubkey, embedProfile);
const { isLoading, profile } = useProfile(pubkey, data);
return (
<UserContext.Provider value={{ pubkey, profile, isError, isLoading }}>
<UserContext.Provider value={{ pubkey, isLoading, profile }}>
{children}
</UserContext.Provider>
);