mirror of https://github.com/vector-im/riot-web
Fix Promise.defer warnings in getconfig.js (#7409)
Signed-off-by: Aaron Raimist <aaron@raim.ist>pull/7444/head
parent
b09aa2cff3
commit
a5fb33de02
|
@ -33,8 +33,7 @@ export async function getVectorConfig(relativeLocation) {
|
|||
}
|
||||
|
||||
function getConfig(configJsonFilename) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
request(
|
||||
{ method: "GET", url: configJsonFilename },
|
||||
(err, response, body) => {
|
||||
|
@ -48,10 +47,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;
|
||||
}
|
||||
|
||||
|
@ -59,9 +58,8 @@ 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;
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue