MDL-63210 core: convert for loop to forEach in JS

This commit is contained in:
Mark Nelson
2018-08-24 11:31:32 +08:00
parent a9428fab11
commit ce1db1f7db
2 changed files with 4 additions and 5 deletions

View File

@@ -79,14 +79,13 @@ define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Lo
}
// Something failed, reject the remaining promises.
if (exception !== null) {
// If the user isn't doing anything too important, redirect to the login page.
// Redirect to the login page.
if (exception.errorcode === "servicerequireslogin") {
window.location = URL.relativeUrl("/login/index.php");
} else {
for (; i < requests.length; i++) {
request = requests[i];
requests.forEach(function(request) {
request.deferred.reject(exception);
}
});
}
}
};