localize error for fail on create pending creation

This commit is contained in:
Moriz Wahl 2022-03-03 13:04:02 +01:00
parent 950d0181a0
commit 5be959a584
5 changed files with 14 additions and 10 deletions

View File

@ -422,12 +422,14 @@ describe('CreationFormular', () => {
})
it('toasts two errors', () => {
expect(toastErrorSpy).toBeCalledWith(
'Could not created PendingCreation for bob@baumeister.de',
)
expect(toastErrorSpy).toBeCalledWith(
'Could not created PendingCreation for bibi@bloxberg.de',
)
expect(toastErrorSpy).toBeCalledWith([
'creation_form.creation_failed',
{ email: 'bob@baumeister.de' },
])
expect(toastErrorSpy).toBeCalledWith([
'creation_form.creation_failed',
{ email: 'bibi@bloxberg.de' },
])
})
})

View File

@ -171,9 +171,8 @@ export default {
result.data.createPendingCreations.successfulCreation.length,
)
if (result.data.createPendingCreations.failedCreation.length > 0) {
result.data.createPendingCreations.failedCreation.forEach((failed) => {
// TODO: Please localize this error message
this.toastError('Could not created PendingCreation for ' + failed)
result.data.createPendingCreations.failedCreation.forEach((email) => {
this.toastError(this.$t('creation_form.creation_failed', { email }))
})
}
this.$emit('remove-all-bookmark')

View File

@ -5,6 +5,7 @@
"confirmed": "bestätigt",
"creation": "Schöpfung",
"creation_form": {
"creation_failed": "Ausstehende Schöpfung für {email} konnte nicht erzeugt werden.",
"creation_for": "Aktives Grundeinkommen für",
"enter_text": "Text eintragen",
"form": "Schöpfungsformular",

View File

@ -5,6 +5,7 @@
"confirmed": "confirmed",
"creation": "Creation",
"creation_form": {
"creation_failed": "Could not create pending creation for {email}",
"creation_for": "Active Basic Income for",
"enter_text": "Enter text",
"form": "Creation form",

View File

@ -13,7 +13,8 @@ export const toasters = {
})
},
toast(message, options) {
message = message.replace(/^GraphQL error: /, '')
// for unit tests, check that replace is present
if (message.replace) message = message.replace(/^GraphQL error: /, '')
this.$bvToast.toast(message, {
autoHideDelay: 5000,
appendToast: true,