mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 09:44:41 +02:00
Update:Notifications onTest for testing and parse title/body template #996
This commit is contained in:
parent
8e8046541e
commit
0ef2a2e4b6
9 changed files with 202 additions and 139 deletions
|
@ -59,6 +59,15 @@ export default {
|
|||
this.selectedNotification = null
|
||||
this.showEditModal = true
|
||||
},
|
||||
validateAppriseApiUrl() {
|
||||
try {
|
||||
return new URL(this.appriseApiUrl)
|
||||
} catch (error) {
|
||||
console.log('URL error', error)
|
||||
this.$toast.error(error.message)
|
||||
return false
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
if (this.notificationSettings && this.notificationSettings.appriseApiUrl == this.appriseApiUrl) {
|
||||
this.$toast.info('No update necessary')
|
||||
|
@ -69,7 +78,10 @@ export default {
|
|||
this.$refs.apiUrlInput.blur()
|
||||
}
|
||||
|
||||
// TODO: Validate apprise api url
|
||||
const isValid = this.validateAppriseApiUrl()
|
||||
if (!isValid) {
|
||||
return
|
||||
}
|
||||
|
||||
const updatePayload = {
|
||||
appriseApiUrl: this.appriseApiUrl || null
|
||||
|
@ -99,14 +111,25 @@ export default {
|
|||
if (!notificationResponse) {
|
||||
return
|
||||
}
|
||||
this.notificationSettings = notificationResponse.settings
|
||||
this.notificationData = notificationResponse.data
|
||||
this.appriseApiUrl = this.notificationSettings.appriseApiUrl
|
||||
this.notifications = this.notificationSettings.notifications || []
|
||||
this.setNotificationSettings(notificationResponse.settings)
|
||||
},
|
||||
setNotificationSettings(notificationSettings) {
|
||||
this.notificationSettings = notificationSettings
|
||||
this.appriseApiUrl = notificationSettings.appriseApiUrl
|
||||
this.notifications = notificationSettings.notifications || []
|
||||
},
|
||||
notificationsUpdated(notificationSettings) {
|
||||
console.log('Notifications updated', notificationSettings)
|
||||
this.setNotificationSettings(notificationSettings)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
this.$root.socket.on('notifications_updated', this.notificationsUpdated)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$root.socket.off('notifications_updated', this.notificationsUpdated)
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue