Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function loadInitialState(callback) {
storage.getMany(['config', 'user'], function (error, data) {
if (error) { console.log(error) };
if (data) {
_configureStore(data, callback);
}
});
}
function loadInitialState(callback) {
storage.getMany(['config', 'user'], function(error, data) {
if (error){console.log(error)};
if (data) {
_configureStore(data, callback);
}
});
}
loadLangs(callback) {
let _this = this;
if (fs.existsSync(storage.getDataPath())) {
let lng_to_load = [];
let dir = fs.readdirSync(storage.getDataPath());
for (let x = 0; x < dir.length; x++) {
if (dir[x].indexOf('lang.') >= 0) {
lng_to_load.push(dir[x].replace('.json', ''));
}
}
if (!lng_to_load.length) {
return;
}
storage.getMany(lng_to_load, function (error, langs) {
if (error) throw new Error("Can't load selected translation");
let lng;
for (lng in langs.lang) {
_this.langsCount++;
}
if (langs.lang[Config.get('lang', _this.default)] === undefined) {
_this.default = lng;
Config.set('lang', _this.default);
}
_this.languages = langs.lang;
if (callback) {
callback();
}
});
}
}