From fe54426f3afba00846380b3b59c3ca113a66222f Mon Sep 17 00:00:00 2001 From: styppo Date: Sat, 28 Jan 2023 01:35:26 +0000 Subject: [PATCH] Subscribe to user events after sign in, closes #28 --- src/components/Sidebar/WelcomeBox.vue | 2 +- src/components/SignIn/SignInDialog.vue | 2 +- src/components/SignIn/SignInForm.vue | 6 +++--- src/components/SignIn/SignUpForm.vue | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/Sidebar/WelcomeBox.vue b/src/components/Sidebar/WelcomeBox.vue index 3b052e6..028538b 100644 --- a/src/components/Sidebar/WelcomeBox.vue +++ b/src/components/Sidebar/WelcomeBox.vue @@ -49,7 +49,7 @@ export default { useExtension: true, } this.settings.addAccount(account) - this.settings.switchAccount(pubkey) + this.app.switchAccount(pubkey) this.nostr.getProfile(pubkey) }, diff --git a/src/components/SignIn/SignInDialog.vue b/src/components/SignIn/SignInDialog.vue index 0303859..50d3f36 100644 --- a/src/components/SignIn/SignInDialog.vue +++ b/src/components/SignIn/SignInDialog.vue @@ -115,7 +115,7 @@ export default { useExtension: true, } this.settings.addAccount(account) - this.settings.switchAccount(pubkey) + this.app.switchAccount(pubkey) this.onComplete({pubkey}) }, diff --git a/src/components/SignIn/SignInForm.vue b/src/components/SignIn/SignInForm.vue index df337ff..2ea2cc6 100644 --- a/src/components/SignIn/SignInForm.vue +++ b/src/components/SignIn/SignInForm.vue @@ -22,6 +22,7 @@ import {decode as bech32decode} from 'bech32-buffer' import {bech32prefix, bech32ToHex} from 'src/utils/utils' import {useSettingsStore} from 'stores/Settings' +import {useAppStore} from 'stores/App' export default { name: 'SignInForm', @@ -91,9 +92,8 @@ export default { opts = {privkey: bech32ToHex(this.key)} } - const settings = useSettingsStore() - const account = settings.addAccount(opts) - settings.switchAccount(account.pubkey) + const account = useSettingsStore().addAccount(opts) + useAppStore().switchAccount(account.pubkey) this.$emit('complete', {pubkey: account.pubkey}) }, diff --git a/src/components/SignIn/SignUpForm.vue b/src/components/SignIn/SignUpForm.vue index d6a19d3..3153223 100644 --- a/src/components/SignIn/SignUpForm.vue +++ b/src/components/SignIn/SignUpForm.vue @@ -37,10 +37,11 @@ export default { const settings = useSettingsStore() const account = settings.addAccount({privkey}) - settings.switchAccount(account.pubkey) + const app = useAppStore() + app.switchAccount(account.pubkey) const event = EventBuilder.metadata(account.pubkey, {name: this.username}).build() - await useAppStore().signEvent(event) + await app.signEvent(event) if (await useNostrStore().publish(event)) { this.$emit('complete', { pubkey: account.pubkey,