import { useContext } from "react";
import { AvatarContext } from "./AvatarProvider";

export function useSaveAvatar() : (fromPublicKey: string, path : string, decryptedContent : string) => Promise<void> {
    const context : any = useContext(AvatarContext);
    if(!context){ 
        throw new Error("useSaveAvatar must be used within an AvatarProvider");
    }
    return context.saveAvatar;
}