readonly login sessions

This commit is contained in:
2023-09-23 22:21:37 +01:00
parent 3efb5321f6
commit 94da60ebfa
30 changed files with 217 additions and 119 deletions

View File

@ -43,8 +43,8 @@ export default function Nip5Service(props: Nip05ServiceProps) {
const navigate = useNavigate();
const { helpText = true } = props;
const { formatMessage } = useIntl();
const pubkey = useLogin().publicKey;
const user = useUserProfile(pubkey);
const { publicKey } = useLogin(s => ({ publicKey: s.publicKey }));
const user = useUserProfile(publicKey);
const publisher = useEventPublisher();
const svc = useMemo(() => new ServiceProvider(props.service), [props.service]);
const [serviceConfig, setServiceConfig] = useState<ServiceConfig>();
@ -179,11 +179,11 @@ export default function Nip5Service(props: Nip05ServiceProps) {
}
async function startBuy(handle: string, domain: string) {
if (!pubkey) {
if (!publicKey) {
return;
}
const rsp = await svc.RegisterHandle(handle, domain, pubkey);
const rsp = await svc.RegisterHandle(handle, domain, publicKey);
if ("error" in rsp) {
setError(rsp);
} else {
@ -193,7 +193,7 @@ export default function Nip5Service(props: Nip05ServiceProps) {
}
async function claimForSubscription(handle: string, domain: string, sub: string) {
if (!pubkey || !publisher) {
if (!publicKey || !publisher) {
return;
}