mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 21:20:32 -04:00
show error message in banner rather than an alert
the banner is a nicer user experience, and consistent with how we display errors elsewhere in notify. For now pass through the error message from JS, but we'll probably want to change that since the erorr messages themselves are often a bit cryptic and unhelpful
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
.on('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
// hide any existing error prompt
|
||||
window.GOVUK.ErrorBanner.hideBanner();
|
||||
|
||||
fetch('/webauthn/register')
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
@@ -44,9 +47,9 @@
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
// some browsers will show an error dialogue for some
|
||||
// errors; to be safe we always pop up an alert
|
||||
var message = error.message || error;
|
||||
alert('Error during registration.\n\n' + message);
|
||||
// errors; to be safe we always display an error message on the page.
|
||||
const message = error.message || error;
|
||||
window.GOVUK.ErrorBanner.showBanner('Something went wrong');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user