Update: ereader toasts

This commit is contained in:
Nicholas Wallace 2024-08-28 21:05:59 -07:00
parent 1d0b824181
commit 9f525309d9
3 changed files with 16 additions and 10 deletions

View file

@ -329,8 +329,7 @@ export default {
.then((data) => { .then((data) => {
this.processing = false this.processing = false
if (data.error) { if (data.error) {
this.$toast.error(`Failed to create account: ${data.error}`) this.$toast.error(this.$strings.ToastNewUserCreatedFailed + ': ' + data.error)
this.$toast.error(this.$strings.ToastNewUserCreatedFailed.replace('{0}', data.error))
} else { } else {
this.$toast.success(this.$strings.ToastNewUserCreatedSuccess) this.$toast.success(this.$strings.ToastNewUserCreatedSuccess)
this.show = false this.show = false

View file

@ -125,12 +125,12 @@ export default {
this.$refs.ereaderEmailInput.blur() this.$refs.ereaderEmailInput.blur()
if (!this.newDevice.name?.trim() || !this.newDevice.email?.trim()) { if (!this.newDevice.name?.trim() || !this.newDevice.email?.trim()) {
this.$toast.error('Name and email required') this.$toast.error(this.$strings.ToastNameEmailRequired)
return return
} }
if (this.newDevice.availabilityOption === 'specificUsers' && !this.newDevice.users.length) { if (this.newDevice.availabilityOption === 'specificUsers' && !this.newDevice.users.length) {
this.$toast.error('Must select at least one user') this.$toast.error(this.$strings.ToastSelectAtLeastOneUser)
return return
} }
if (this.newDevice.availabilityOption !== 'specificUsers') { if (this.newDevice.availabilityOption !== 'specificUsers') {
@ -142,14 +142,14 @@ export default {
if (!this.ereaderDevice) { if (!this.ereaderDevice) {
if (this.existingDevices.some((d) => d.name === this.newDevice.name)) { if (this.existingDevices.some((d) => d.name === this.newDevice.name)) {
this.$toast.error('Ereader device with that name already exists') this.$toast.error(this.$strings.ToastDeviceNameAlreadyExists)
return return
} }
this.submitCreate() this.submitCreate()
} else { } else {
if (this.ereaderDevice.name !== this.newDevice.name && this.existingDevices.some((d) => d.name === this.newDevice.name)) { if (this.ereaderDevice.name !== this.newDevice.name && this.existingDevices.some((d) => d.name === this.newDevice.name)) {
this.$toast.error('Ereader device with that name already exists') this.$toast.error(this.$strings.ToastDeviceNameAlreadyExists)
return return
} }
@ -174,12 +174,12 @@ export default {
.$post(`/api/emails/ereader-devices`, payload) .$post(`/api/emails/ereader-devices`, payload)
.then((data) => { .then((data) => {
this.$emit('update', data.ereaderDevices) this.$emit('update', data.ereaderDevices)
this.$toast.success('Device updated') this.$toast.success(this.$strings.ToastDeviceUpdateSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to update device', error) console.error('Failed to update device', error)
this.$toast.error('Failed to update device') this.$toast.error(this.$strings.ToastDeviceUpdateFailed)
}) })
.finally(() => { .finally(() => {
this.processing = false this.processing = false
@ -201,12 +201,12 @@ export default {
.$post('/api/emails/ereader-devices', payload) .$post('/api/emails/ereader-devices', payload)
.then((data) => { .then((data) => {
this.$emit('update', data.ereaderDevices || []) this.$emit('update', data.ereaderDevices || [])
this.$toast.success('Device added') this.$toast.success(this.$strings.ToastDeviceAddSuccess)
this.show = false this.show = false
}) })
.catch((error) => { .catch((error) => {
console.error('Failed to add device', error) console.error('Failed to add device', error)
this.$toast.error('Failed to add device') this.$toast.error(this.$strings.ToastDeviceAddFailed)
}) })
.finally(() => { .finally(() => {
this.processing = false this.processing = false

View file

@ -845,6 +845,11 @@
"ToastCollectionUpdateSuccess": "Collection updated", "ToastCollectionUpdateSuccess": "Collection updated",
"ToastDeleteFileFailed": "Failed to delete file", "ToastDeleteFileFailed": "Failed to delete file",
"ToastDeleteFileSuccess": "File deleted", "ToastDeleteFileSuccess": "File deleted",
"ToastDeviceAddFailed": "Failed to add device",
"ToastDeviceAddSuccess": "Device added",
"ToastDeviceNameAlreadyExists": "Ereader device with that name already exists",
"ToastDeviceUpdateFailed": "Failed to update device",
"ToastDeviceUpdateSuccess": "Device updated",
"ToastEpisodeDownloadQueueClearFailed": "Failed to clear queue", "ToastEpisodeDownloadQueueClearFailed": "Failed to clear queue",
"ToastEpisodeDownloadQueueClearSuccess": "Episode download queue cleared", "ToastEpisodeDownloadQueueClearSuccess": "Episode download queue cleared",
"ToastErrorCannotShare": "Cannot share natively on this device", "ToastErrorCannotShare": "Cannot share natively on this device",
@ -873,6 +878,7 @@
"ToastLibraryScanStarted": "Library scan started", "ToastLibraryScanStarted": "Library scan started",
"ToastLibraryUpdateFailed": "Failed to update library", "ToastLibraryUpdateFailed": "Failed to update library",
"ToastLibraryUpdateSuccess": "Library \"{0}\" updated", "ToastLibraryUpdateSuccess": "Library \"{0}\" updated",
"ToastNameEmailRequired": "Name and email are required",
"ToastNewUserCreatedFailed": "Failed to create account: \"{0}\"", "ToastNewUserCreatedFailed": "Failed to create account: \"{0}\"",
"ToastNewUserCreatedSuccess": "New account created", "ToastNewUserCreatedSuccess": "New account created",
"ToastNewUserLibraryError": "Must select at least one library", "ToastNewUserLibraryError": "Must select at least one library",
@ -902,6 +908,7 @@
"ToastRescanUpToDate": "Re-Scan complete item was up to date", "ToastRescanUpToDate": "Re-Scan complete item was up to date",
"ToastRescanUpdated": "Re-Scan complete item was updated", "ToastRescanUpdated": "Re-Scan complete item was updated",
"ToastScanFailed": "Failed to scan library item", "ToastScanFailed": "Failed to scan library item",
"ToastSelectAtLeastOneUser": "Select at least one user",
"ToastSendEbookToDeviceFailed": "Failed to send ebook to device", "ToastSendEbookToDeviceFailed": "Failed to send ebook to device",
"ToastSendEbookToDeviceSuccess": "Ebook sent to device \"{0}\"", "ToastSendEbookToDeviceSuccess": "Ebook sent to device \"{0}\"",
"ToastSeriesUpdateFailed": "Series update failed", "ToastSeriesUpdateFailed": "Series update failed",