Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ function handleError(error) {
const response = JSON.parse(error.response);
if (response.message) {
notifications.error(response.message);
// Check for App messages queue
if (response.messages) {
Object.keys(response.messages).forEach((type) => {
response.messages[type].forEach((message) => {
if (type === 'error') {
notifications.error(message);
} else {
notifications.notify(message);
}
});
});
}
} else {
switch (error.status) {
case 409:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function notify(message, options) {
}

const notifications = {
/* Send and success notification */
/* Send a success notification */
success: (message, options) => {
notify(message, {
type: 'message', // @todo rename it to success
Expand All @@ -38,6 +38,15 @@ const notifications = {
});
},

/* Send a general notification */
notify: (message, options) => {
notify(message, {
type: 'message',
dismiss: true,
...options,
});
},

/* Ask the user a question */
ask: (message) => window.confirm(message),
};
Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ JLIB_MEDIA_ERROR_UPLOAD_INPUT="Unable to upload file."
JLIB_MEDIA_ERROR_WARNFILENAME="File name must only have alphanumeric characters and no spaces."
JLIB_MEDIA_ERROR_WARNFILETOOLARGE="This file is too large to upload. You can change the limits for your site in the component options."
JLIB_MEDIA_ERROR_WARNFILETYPE="This file type is not supported."
JLIB_MEDIA_ERROR_WARNIEXSS="Possible IE XSS Attack found."
JLIB_MEDIA_ERROR_WARNIEXSS="The file looks suspicious, therefore cannot be uploaded."
JLIB_MEDIA_ERROR_WARNINVALID_IMG="Not a valid image."
JLIB_MEDIA_ERROR_WARNINVALID_MIME="Invalid mime type detected."
JLIB_MEDIA_ERROR_WARNINVALID_MIMETYPE="Illegal mime type detected: %s"
Expand Down
2 changes: 1 addition & 1 deletion language/en-GB/lib_joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ JLIB_MEDIA_ERROR_UPLOAD_INPUT="Unable to upload file."
JLIB_MEDIA_ERROR_WARNFILENAME="File name must only have alphanumeric characters and no spaces."
JLIB_MEDIA_ERROR_WARNFILETOOLARGE="This file is too large to upload."
JLIB_MEDIA_ERROR_WARNFILETYPE="This file type is not supported."
JLIB_MEDIA_ERROR_WARNIEXSS="Possible IE XSS Attack found."
JLIB_MEDIA_ERROR_WARNIEXSS="The file looks suspicious, therefore cannot be uploaded."
JLIB_MEDIA_ERROR_WARNINVALID_IMG="Not a valid image."
JLIB_MEDIA_ERROR_WARNINVALID_MIME="Invalid mime type detected."
JLIB_MEDIA_ERROR_WARNINVALID_MIMETYPE="Illegal mime type detected: %s"
Expand Down