3
0

Fix toast errors not displaying full message if it contained :

This commit is contained in:
Jože Fortun 2022-12-22 15:11:35 +01:00
parent 2823c9a36c
commit 2ed398f30f
4 changed files with 24 additions and 4 deletions

View File

@ -36,7 +36,12 @@ export default {
const { prefix, title } = opt
return (err = {}) => {
const msg = err.message ? (prefix + ': ' + err.message) : prefix
// only messages starting with 'notification:' or 'notification.' should be translated
if (err.message && err.message.startsWith('notification')) {
err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`)
}
// all other messages should be shown as they are
const msg = err.message ? `${prefix}: ${err.message}` : prefix
this.toastDanger(msg, title)
}
},

View File

@ -36,7 +36,12 @@ export default {
const { prefix, title } = opt
return (err = {}) => {
const msg = err.message ? (prefix + ': ' + this.$t(err.message)) : prefix
// only messages starting with 'notification:' or 'notification.' should be translated
if (err.message && err.message.startsWith('notification')) {
err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`)
}
// all other messages should be shown as they are
const msg = err.message ? `${prefix}: ${err.message}` : prefix
this.toastDanger(msg, title)
}
},

View File

@ -36,7 +36,12 @@ export default {
const { prefix, title } = opt
return (err = {}) => {
const msg = err.message ? (prefix + ': ' + this.$t(err.message)) : prefix
// only messages starting with 'notification:' or 'notification.' should be translated
if (err.message && err.message.startsWith('notification')) {
err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`)
}
// all other messages should be shown as they are
const msg = err.message ? `${prefix}: ${err.message}` : prefix
this.toastDanger(msg, title)
}
},

View File

@ -28,7 +28,12 @@ export default {
const { prefix, title } = opt
return (err = {}) => {
const msg = err.message ? (prefix + ': ' + err.message) : prefix
// only messages starting with 'notification:' or 'notification.' should be translated
if (err.message && err.message.startsWith('notification')) {
err.message = this.$t(`notification:${err.message.substring('notification.'.length)}`)
}
// all other messages should be shown as they are
const msg = err.message ? `${prefix}: ${err.message}` : prefix
this.toastDanger(msg, title)
}
},