diff --git a/app/javascript/retrospring/features/lists/create.ts b/app/javascript/retrospring/features/lists/create.ts index c9907a3b..c1dbc09c 100644 --- a/app/javascript/retrospring/features/lists/create.ts +++ b/app/javascript/retrospring/features/lists/create.ts @@ -1,4 +1,5 @@ import Rails from '@rails/ujs'; +import { showNotification, showErrorNotification } from 'utilities/notifications'; import I18n from '../../../legacy/i18n'; export function createListHandler(event: Event): void { @@ -17,11 +18,11 @@ export function createListHandler(event: Event): void { document.querySelector('#lists-list ul.list-group').insertAdjacentHTML('beforeend', data.render); } - window['showNotification'](data.message, data.success); + showNotification(data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); - window['showNotification'](I18n.translate('frontend.error.message'), false); + showErrorNotification(I18n.translate('frontend.error.message')); } }); } diff --git a/app/javascript/retrospring/features/lists/destroy.ts b/app/javascript/retrospring/features/lists/destroy.ts index 22d6c766..3a045c3e 100644 --- a/app/javascript/retrospring/features/lists/destroy.ts +++ b/app/javascript/retrospring/features/lists/destroy.ts @@ -1,5 +1,6 @@ import Rails from '@rails/ujs'; import swal from 'sweetalert'; +import { showNotification, showErrorNotification } from 'utilities/notifications'; import I18n from '../../../legacy/i18n'; export function destroyListHandler(event: Event): void { @@ -32,11 +33,11 @@ export function destroyListHandler(event: Event): void { } } - window['showNotification'](data.message, data.success); + showNotification(data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); - window['showNotification'](I18n.translate('frontend.error.message'), false); + showErrorNotification(I18n.translate('frontend.error.message')); } }); }); diff --git a/app/javascript/retrospring/features/lists/membership.ts b/app/javascript/retrospring/features/lists/membership.ts index d2d63f7e..4443dd62 100644 --- a/app/javascript/retrospring/features/lists/membership.ts +++ b/app/javascript/retrospring/features/lists/membership.ts @@ -1,4 +1,5 @@ import Rails from '@rails/ujs'; +import { showNotification, showErrorNotification } from 'utilities/notifications'; import I18n from '../../../legacy/i18n'; export function listMembershipHandler(event: Event): void { @@ -24,11 +25,11 @@ export function listMembershipHandler(event: Event): void { document.querySelector(`span#${list}-members`).innerHTML = memberCount.toString(); } - window['showNotification'](data.message, data.success); + showNotification(data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); - window['showNotification'](I18n.translate('frontend.error.message'), false); + showErrorNotification(I18n.translate('frontend.error.message')); }, complete: () => { checkbox.removeAttribute('disabled'); diff --git a/app/javascript/retrospring/features/user/action.ts b/app/javascript/retrospring/features/user/action.ts index 55788562..0cf16c0f 100644 --- a/app/javascript/retrospring/features/user/action.ts +++ b/app/javascript/retrospring/features/user/action.ts @@ -1,4 +1,5 @@ import Rails from '@rails/ujs'; +import { showNotification, showErrorNotification } from 'utilities/notifications'; import I18n from '../../../legacy/i18n'; export function userActionHandler(event: Event): void { @@ -17,11 +18,11 @@ export function userActionHandler(event: Event): void { }).toString(), success: (data) => { success = data.success; - window['showNotification'](data.message, data.success); + showNotification(data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); - window['showNotification'](I18n.translate('frontend.error.message'), false); + showErrorNotification(I18n.translate('frontend.error.message')); }, complete: () => { if (!success) return;