diff --git a/packages/common/error.js b/packages/common/error.js index 5a53bda9dedaba9ca4be96d7c402098e85d4c98a..8c8be68c7a6f5a34122308bc3c037c9ff38182df 100644 --- a/packages/common/error.js +++ b/packages/common/error.js @@ -7,8 +7,9 @@ import {i18n} from "./i18n"; * @param jqXHR * @param textStatus * @param errorThrown + * @param icon */ -export const handleXhrError = (jqXHR, textStatus, errorThrown) => { +export const handleXhrError = (jqXHR, textStatus, errorThrown, icon = "sad") => { if (textStatus !== "abort") { // try to show hydra error text let body = jqXHR.responseJSON !== undefined && jqXHR.responseJSON["hydra:description"] !== undefined ? @@ -22,6 +23,7 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { notify({ "summary": i18n.t('error.summary'), "body": body, + "icon": icon, "type": "danger", }); } @@ -32,8 +34,9 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { * * @param error * @param summary + * @param icon */ -export const handleFetchError = async (error, summary = "") => { +export const handleFetchError = async (error, summary = "", icon = "sad") => { // return if user aborted the request if (error.name === "AbortError") { return; @@ -57,6 +60,7 @@ export const handleFetchError = async (error, summary = "") => { notify({ "summary": summary === "" ? i18n.t('error.summary') : summary, "body": body, + "icon": icon, "type": "danger", }); }; diff --git a/packages/common/styles.js b/packages/common/styles.js index 448f086dd5642a80c662c2cd64216a9372fa7bbb..3adf59f4f49951dfa7254d4b03a34b845476e21a 100644 --- a/packages/common/styles.js +++ b/packages/common/styles.js @@ -298,6 +298,11 @@ export function getNotificationCSS() { background: transparent; } + .notification vpu-icon { + font-size: 1.4em; + margin-right: 0.4em; + } + .notification > .delete { position: absolute; right: 0.5rem;