Merge branch 'fix-login-and-pubkey' into 'main'

Ensure relay subscription is open & set pubkey when the signer changes

See merge request soapbox-pub/soapbox!3044
environments/review-main-yi2y9f/deployments/4656
Alex Gleason 4 months ago
commit 376090015e

@ -17,6 +17,9 @@ function logInNostr(pubkey: string) {
const relay = getState().instance.nostr?.relay;
// HACK: waits 1 second to ensure the relay subscription is open
await new Promise((resolve) => setTimeout(resolve, 1000));
const token = await dispatch(obtainOAuthToken({
grant_type: 'nostr_bunker',
pubkey,
@ -47,4 +50,4 @@ function setNostrPubkey(pubkey: string) {
};
}
export { logInNostr, nostrExtensionLogIn, setNostrPubkey, NOSTR_PUBKEY_SET };
export { logInNostr, nostrExtensionLogIn, setNostrPubkey, NOSTR_PUBKEY_SET };

@ -15,7 +15,7 @@ function useSignerStream() {
useEffect(() => {
if (signer) {
signer.getPublicKey().then(setPubkey).catch(console.warn);
signer.getPublicKey().then((pubkey) => setPubkey(pubkey)).catch(console.warn);
}
}, [signer]);

Loading…
Cancel
Save