[feat] UI for user notifications (#3267)

This commit is contained in:
Vlad Stan
2025-07-15 11:15:17 +02:00
committed by dni ⚡
parent 5e9919c5c5
commit 094a9fc1a1
7 changed files with 142 additions and 6 deletions
+32
View File
@@ -80,6 +80,11 @@ window.AccountPageLogic = {
token_id_list: [],
allRead: false,
allWrite: false
},
notifications: {
nostr: {
identifier: ''
}
}
}
},
@@ -394,8 +399,35 @@ window.AccountPageLogic = {
} finally {
this.apiAcl.password = ''
}
},
addNostrNotificationIdentifier() {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
if (!emailRegex.test(this.notifications.nostr.identifier)) {
Quasar.Notify.create({
type: 'warning',
message: 'Invalid email format.'
})
return
}
const identifier = this.user.extra.nostr_notification_identifiers.find(
i => i === this.notifications.nostr.identifier
)
if (identifier) {
return
}
this.user.extra.nostr_notification_identifiers.push(
this.notifications.nostr.identifier
)
this.notifications.nostr.identifier = ''
},
removeNostrNotificationIdentifier(identifier) {
this.user.extra.nostr_notification_identifiers =
this.user.extra.nostr_notification_identifiers.filter(
i => i !== identifier
)
}
},
async created() {
try {
const {data} = await LNbits.api.getAuthenticatedUser()