Fix Promise.defer warnings in index.js (#7409)

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2018-10-02 19:27:19 -05:00
parent a5fb33de02
commit 54c46df0dc
No known key found for this signature in database
GPG Key ID: 37419210002890EF

View File

@ -179,8 +179,7 @@ function makeRegistrationUrl(params) {
}
function getConfig(configJsonFilename) {
let deferred = Promise.defer();
return new Promise(function(resolve, reject) {
request(
{ method: "GET", url: configJsonFilename },
(err, response, body) => {
@ -194,10 +193,10 @@ function getConfig(configJsonFilename) {
// from a file:// URI.
if (response) {
if (response.status == 404 || (response.status == 0 && body == '')) {
deferred.resolve({});
resolve({});
}
}
deferred.reject({err: err, response: response});
reject({err: err, response: response});
return;
}
@ -205,11 +204,10 @@ function getConfig(configJsonFilename) {
// parameter, since this throws a parse error on empty
// which breaks if there's no config.json and we're
// loading from the filesystem (see above).
deferred.resolve(JSON.parse(body));
resolve(JSON.parse(body));
}
);
return deferred.promise;
})
}
function onTokenLoginCompleted() {