mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
fix deprecation warning
This commit is contained in:
parent
02217c8bd2
commit
4a1ba01f44
1 changed files with 21 additions and 26 deletions
|
@ -231,35 +231,30 @@ export function getCurrentLanguage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLangsJson() {
|
function getLangsJson() {
|
||||||
const deferred = Promise.defer();
|
return new Promise((resolve, reject) => {
|
||||||
|
request(
|
||||||
request(
|
{ method: "GET", url: i18nFolder + 'languages.json' },
|
||||||
{ method: "GET", url: i18nFolder + 'languages.json' },
|
(err, response, body) => {
|
||||||
(err, response, body) => {
|
if (err || response.status < 200 || response.status >= 300) {
|
||||||
if (err || response.status < 200 || response.status >= 300) {
|
reject({err: err, response: response});
|
||||||
deferred.reject({err: err, response: response});
|
}
|
||||||
return;
|
resolve(JSON.parse(body));
|
||||||
}
|
}
|
||||||
deferred.resolve(JSON.parse(body));
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLanguage(langPath) {
|
function getLanguage(langPath) {
|
||||||
const deferred = Promise.defer();
|
return new Promise((resolve, reject) => {
|
||||||
|
let response_return = {};
|
||||||
let response_return = {};
|
request(
|
||||||
request(
|
{ method: "GET", url: langPath },
|
||||||
{ method: "GET", url: langPath },
|
(err, response, body) => {
|
||||||
(err, response, body) => {
|
if (err || response.status < 200 || response.status >= 300) {
|
||||||
if (err || response.status < 200 || response.status >= 300) {
|
reject({err: err, response: response});
|
||||||
deferred.reject({err: err, response: response});
|
}
|
||||||
return;
|
resolve(JSON.parse(body));
|
||||||
}
|
}
|
||||||
|
);
|
||||||
deferred.resolve(JSON.parse(body));
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
return deferred.promise;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue