Skip to content
Snippets Groups Projects
Commit c979823f authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Add vpu-icon to notification message

parent 832fa848
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,9 @@ import {i18n} from "./i18n"; ...@@ -7,8 +7,9 @@ import {i18n} from "./i18n";
* @param jqXHR * @param jqXHR
* @param textStatus * @param textStatus
* @param errorThrown * @param errorThrown
* @param icon
*/ */
export const handleXhrError = (jqXHR, textStatus, errorThrown) => { export const handleXhrError = (jqXHR, textStatus, errorThrown, icon = "sad") => {
if (textStatus !== "abort") { if (textStatus !== "abort") {
// try to show hydra error text // try to show hydra error text
let body = jqXHR.responseJSON !== undefined && jqXHR.responseJSON["hydra:description"] !== undefined ? let body = jqXHR.responseJSON !== undefined && jqXHR.responseJSON["hydra:description"] !== undefined ?
...@@ -22,6 +23,7 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { ...@@ -22,6 +23,7 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => {
notify({ notify({
"summary": i18n.t('error.summary'), "summary": i18n.t('error.summary'),
"body": body, "body": body,
"icon": icon,
"type": "danger", "type": "danger",
}); });
} }
...@@ -32,8 +34,9 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => { ...@@ -32,8 +34,9 @@ export const handleXhrError = (jqXHR, textStatus, errorThrown) => {
* *
* @param error * @param error
* @param summary * @param summary
* @param icon
*/ */
export const handleFetchError = async (error, summary = "") => { export const handleFetchError = async (error, summary = "", icon = "sad") => {
// return if user aborted the request // return if user aborted the request
if (error.name === "AbortError") { if (error.name === "AbortError") {
return; return;
...@@ -57,6 +60,7 @@ export const handleFetchError = async (error, summary = "") => { ...@@ -57,6 +60,7 @@ export const handleFetchError = async (error, summary = "") => {
notify({ notify({
"summary": summary === "" ? i18n.t('error.summary') : summary, "summary": summary === "" ? i18n.t('error.summary') : summary,
"body": body, "body": body,
"icon": icon,
"type": "danger", "type": "danger",
}); });
}; };
...@@ -298,6 +298,11 @@ export function getNotificationCSS() { ...@@ -298,6 +298,11 @@ export function getNotificationCSS() {
background: transparent; background: transparent;
} }
.notification vpu-icon {
font-size: 1.4em;
margin-right: 0.4em;
}
.notification > .delete { .notification > .delete {
position: absolute; position: absolute;
right: 0.5rem; right: 0.5rem;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment