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() {
|
||||
const deferred = Promise.defer();
|
||||
|
||||
request(
|
||||
{ method: "GET", url: i18nFolder + 'languages.json' },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
deferred.reject({err: err, response: response});
|
||||
return;
|
||||
return new Promise((resolve, reject) => {
|
||||
request(
|
||||
{ method: "GET", url: i18nFolder + 'languages.json' },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
reject({err: err, response: response});
|
||||
}
|
||||
resolve(JSON.parse(body));
|
||||
}
|
||||
deferred.resolve(JSON.parse(body));
|
||||
}
|
||||
);
|
||||
return deferred.promise;
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function getLanguage(langPath) {
|
||||
const deferred = Promise.defer();
|
||||
|
||||
let response_return = {};
|
||||
request(
|
||||
{ method: "GET", url: langPath },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
deferred.reject({err: err, response: response});
|
||||
return;
|
||||
return new Promise((resolve, reject) => {
|
||||
let response_return = {};
|
||||
request(
|
||||
{ method: "GET", url: langPath },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
reject({err: err, response: response});
|
||||
}
|
||||
resolve(JSON.parse(body));
|
||||
}
|
||||
|
||||
deferred.resolve(JSON.parse(body));
|
||||
}
|
||||
);
|
||||
return deferred.promise;
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue