Fix signer error
This commit is contained in:
parent
fee6f565ff
commit
725ef45d9d
1 changed files with 4 additions and 6 deletions
|
|
@ -12,9 +12,8 @@ export class MailNotifications {
|
||||||
_controller = maybe<AbortController>()
|
_controller = maybe<AbortController>()
|
||||||
|
|
||||||
async register(email: string, frequency: string) {
|
async register(email: string, frequency: string) {
|
||||||
const $app = app.get()
|
const $user = User.require(app.get())
|
||||||
const $pubkey = User.require($app).pubkey
|
const $signer = $user.signer
|
||||||
const $signer = $app.signer
|
|
||||||
|
|
||||||
if (!$signer) throw new Error("No signer available")
|
if (!$signer) throw new Error("No signer available")
|
||||||
|
|
||||||
|
|
@ -23,7 +22,7 @@ export class MailNotifications {
|
||||||
|
|
||||||
const res = await fetch(buildUrl(EMAIL_NOTIFICATION_SERVER, "subscription", "email"), {
|
const res = await fetch(buildUrl(EMAIL_NOTIFICATION_SERVER, "subscription", "email"), {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({email, frequency, pubkey: $pubkey}),
|
body: JSON.stringify({email, frequency, pubkey: $user.pubkey}),
|
||||||
headers: {Authorization: authHeader, "Content-Type": "application/json"},
|
headers: {Authorization: authHeader, "Content-Type": "application/json"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -37,8 +36,7 @@ export class MailNotifications {
|
||||||
const {key} = emailNotificationState.get()
|
const {key} = emailNotificationState.get()
|
||||||
if (!key) return
|
if (!key) return
|
||||||
|
|
||||||
const $app = app.get()
|
const $signer = app.get().user?.signer
|
||||||
const $signer = $app.signer
|
|
||||||
if (!$signer) return
|
if (!$signer) return
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue