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
This commit is contained in:
Alex Gleason 2024-05-31 16:51:05 +00:00
commit 376090015e
2 changed files with 5 additions and 2 deletions

View File

@ -17,6 +17,9 @@ function logInNostr(pubkey: string) {
const relay = getState().instance.nostr?.relay; 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({ const token = await dispatch(obtainOAuthToken({
grant_type: 'nostr_bunker', grant_type: 'nostr_bunker',
pubkey, pubkey,

View File

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