Subscribe to user events after sign in, closes #28

This commit is contained in:
styppo 2023-01-28 01:35:26 +00:00
parent a6adc94c1c
commit fe54426f3a
No known key found for this signature in database
GPG Key ID: 3AAA685C50724C28
4 changed files with 8 additions and 7 deletions

View File

@ -49,7 +49,7 @@ export default {
useExtension: true, useExtension: true,
} }
this.settings.addAccount(account) this.settings.addAccount(account)
this.settings.switchAccount(pubkey) this.app.switchAccount(pubkey)
this.nostr.getProfile(pubkey) this.nostr.getProfile(pubkey)
}, },

View File

@ -115,7 +115,7 @@ export default {
useExtension: true, useExtension: true,
} }
this.settings.addAccount(account) this.settings.addAccount(account)
this.settings.switchAccount(pubkey) this.app.switchAccount(pubkey)
this.onComplete({pubkey}) this.onComplete({pubkey})
}, },

View File

@ -22,6 +22,7 @@
import {decode as bech32decode} from 'bech32-buffer' import {decode as bech32decode} from 'bech32-buffer'
import {bech32prefix, bech32ToHex} from 'src/utils/utils' import {bech32prefix, bech32ToHex} from 'src/utils/utils'
import {useSettingsStore} from 'stores/Settings' import {useSettingsStore} from 'stores/Settings'
import {useAppStore} from 'stores/App'
export default { export default {
name: 'SignInForm', name: 'SignInForm',
@ -91,9 +92,8 @@ export default {
opts = {privkey: bech32ToHex(this.key)} opts = {privkey: bech32ToHex(this.key)}
} }
const settings = useSettingsStore() const account = useSettingsStore().addAccount(opts)
const account = settings.addAccount(opts) useAppStore().switchAccount(account.pubkey)
settings.switchAccount(account.pubkey)
this.$emit('complete', {pubkey: account.pubkey}) this.$emit('complete', {pubkey: account.pubkey})
}, },

View File

@ -37,10 +37,11 @@ export default {
const settings = useSettingsStore() const settings = useSettingsStore()
const account = settings.addAccount({privkey}) 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() const event = EventBuilder.metadata(account.pubkey, {name: this.username}).build()
await useAppStore().signEvent(event) await app.signEvent(event)
if (await useNostrStore().publish(event)) { if (await useNostrStore().publish(event)) {
this.$emit('complete', { this.$emit('complete', {
pubkey: account.pubkey, pubkey: account.pubkey,