From 8f81426fa4e7d1c32c94183ff72dbd9e45d0b72d Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 13 Feb 2024 14:54:42 +0100 Subject: [PATCH] Corrected error when using alertMultiple and handleSystemMessage --- public/js/plugin/FhcAlert.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/js/plugin/FhcAlert.js b/public/js/plugin/FhcAlert.js index 079039aed..307064d76 100644 --- a/public/js/plugin/FhcAlert.js +++ b/public/js/plugin/FhcAlert.js @@ -237,7 +237,7 @@ export default { alertMultiple(messageArray, severity = 'info', title = 'Info', sticky = false){ // Check, if array has only string values if (messageArray.every(message => typeof message === 'string')) { - messageArray.every(message => this.alertDefault(severity, title, message, sticky)); + messageArray.forEach(message => this.alertDefault(severity, title, message, sticky)); return true; } return false; @@ -281,21 +281,24 @@ export default { handleSystemMessage(message) { // Message is string if (typeof message === 'string') - return fhcerror.alertWarning(message); + return $fhcAlert.alertWarning(message); // Message is array of strings if (Array.isArray(message)) { // If Array has only Strings if (message.every(msg => typeof msg === 'string')) - return message.every(fhcerror.alertWarning); + return message.every($fhcAlert.alertWarning); // If Array has only Objects if (message.every(msg => typeof msg === 'object') && msg !== null) { return message.every(msg => { if (msg.hasOwnProperty('data') && msg.data.hasOwnProperty('retval')) { - fhcerror.alertWarning(JSON.stringify(msg.data.retval)); + $fhcAlert.alertWarning(JSON.stringify(msg.data.retval)); } else { - fhcerror.alertSystemError(JSON.stringify(msg)); + console.log('FhcAlert systemError'); + console.log(msg); + console.log(JSON.stringify(msg)); + $fhcAlert.alertSystemError(JSON.stringify(msg)); } }); } @@ -305,15 +308,15 @@ export default { if (typeof message === 'object' && message !== null){ if (message.hasOwnProperty('data') && message.data.hasOwnProperty('retval')) { // NOTE(chris): changed: alertSystemError => alertWarning - fhcerror.alertWarning(JSON.stringify(message.data.retval)); + $fhcAlert.alertWarning(JSON.stringify(message.data.retval)); } else { - fhcerror.alertSystemError(JSON.stringify(message)); + $fhcAlert.alertSystemError(JSON.stringify(message)); } return; } // Fallback - fhcerror.alertSystemError('alertSystemError throws Generic Error\r\nError Controller Path: ' + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method); + $fhcAlert.alertSystemError('alertSystemError throws Generic Error\r\nError Controller Path: ' + FHC_JS_DATA_STORAGE_OBJECT.called_path + '/' + FHC_JS_DATA_STORAGE_OBJECT.called_method); }, resetFormValidation(form) { const event = new Event('fhc-form-reset');