docbrown/app/javascript/admin/messageUtilities.js
Arit Amana 8cbbc222e9
Heavy Confirmation Flow for Broadcast-Destroy (#14819)
* hook up frontend parts

* complete backend, save success alert issues

* fix broken existing specs

* complete snackbar confirmation on page redirect

* rollback success alert; but leave foundation for it in place

* preserve a11y features of snackbar; complete cypress tests

* test redirect after braodcast destroy
2021-09-29 07:43:00 -04:00

31 lines
830 B
JavaScript

/**
* A function to generate an error alert within the /admin/ space.
*
* @function displayErrorAlert
* @param {Object} modalProps Properties of the Error Alert
* @param {string} modalProps.alertMsg The message displayed within the alert.
*/
export const displayErrorAlert = function (alertMsg) {
return document.dispatchEvent(
new CustomEvent('error:generate', {
detail: { alertMsg },
}),
);
};
/**
* A function to generate a snackbar within the /admin/ space.
*
* @function displaySnackbar
* @param {Object} modalProps Properties of the Snackbar
* @param {string} modalProps.message The message displayed within the snackbar.
*/
export const displaySnackbar = function (message) {
return document.dispatchEvent(
new CustomEvent('snackbar:add', {
detail: { message },
}),
);
};