mirror of
https://github.com/pi-hole/web.git
synced 2025-12-20 10:48:26 +00:00
@@ -111,6 +111,20 @@ function showAlert(type, icon, title, message) {
|
||||
options.title = " <strong>Error, something went wrong!</strong><br>";
|
||||
settings.delay *= 2;
|
||||
|
||||
// If the message is an API object, nicely format the error message
|
||||
// Try to parse message as JSON
|
||||
try {
|
||||
var data = JSON.parse(message);
|
||||
console.log(data); // eslint-disable-line no-console
|
||||
if (data.error !== undefined) {
|
||||
options.title = " <strong>" + data.error.message + "</strong><br>";
|
||||
|
||||
if (data.error.hint !== null) options.message = data.error.hint;
|
||||
}
|
||||
} catch {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
// Case not handled, do nothing
|
||||
|
||||
Reference in New Issue
Block a user