diff --git a/resources/js/nostrLogin.js b/resources/js/nostrLogin.js index 88d7563..7b6c15d 100644 --- a/resources/js/nostrLogin.js +++ b/resources/js/nostrLogin.js @@ -5,6 +5,11 @@ export default () => ({ startTime: null, pollCount: 0, MAX_POLL_COUNT: 30, + // Toggled while window.nostr.signEvent is awaiting the wallet so we can + // pause wire:poll, preventing it from racing with auth()->login()'s + // session-id migration (which would otherwise yield a 419 on the next + // round-trip). + nostrLoginInProgress: false, async init() { this.startTime = Date.now(); @@ -42,47 +47,66 @@ export default () => ({ }, async openNostrLogin() { - const challenge = await this.resolveChallenge(); + // Flip the flag immediately so the wire:poll