Fix signer error

This commit is contained in:
mplorentz 2026-08-20 11:51:26 -04:00
parent fee6f565ff
commit 725ef45d9d

View file

@ -12,9 +12,8 @@ export class MailNotifications {
_controller = maybe<AbortController>()
async register(email: string, frequency: string) {
const $app = app.get()
const $pubkey = User.require($app).pubkey
const $signer = $app.signer
const $user = User.require(app.get())
const $signer = $user.signer
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"), {
method: "POST",
body: JSON.stringify({email, frequency, pubkey: $pubkey}),
body: JSON.stringify({email, frequency, pubkey: $user.pubkey}),
headers: {Authorization: authHeader, "Content-Type": "application/json"},
})
@ -37,8 +36,7 @@ export class MailNotifications {
const {key} = emailNotificationState.get()
if (!key) return
const $app = app.get()
const $signer = $app.signer
const $signer = app.get().user?.signer
if (!$signer) return
try {