mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-26 07:46:31 +01:00
sanity checks for JS fetch errors
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -99,7 +99,7 @@ export default class Updates {
|
||||
if (!this.payload.resources.total) { return this; }
|
||||
|
||||
[plugins, themes].forEach(function(resources, index) {
|
||||
if (!resources || Array.isArray(resources)) { return; }
|
||||
if (!resources || Array.isArray(resources) || typeof resources !== 'object') { return; }
|
||||
let length = Object.keys(resources).length;
|
||||
let type = map[index];
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ let request = function(url, options = {}, callback = () => true) {
|
||||
let data = new FormData();
|
||||
|
||||
options.body = Object.assign({ 'admin-nonce': config.admin_nonce }, options.body || {});
|
||||
Object.keys(options.body).map((key) => data.append(key, options.body[key]));
|
||||
if (options.body && typeof options.body === 'object') {
|
||||
Object.keys(options.body).map((key) => data.append(key, options.body[key]));
|
||||
}
|
||||
options.body = data;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ export function userFeedback(response) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (settings) {
|
||||
if (settings && typeof settings === 'object' && settings !== null) {
|
||||
backup = Object.assign({}, toastr.options);
|
||||
Object.keys(settings).forEach((key) => { toastr.options[key] = settings[key]; });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user