vtb-appit 0.0.96 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/appit.js +17 -5
- package/package.json +1 -1
package/appit.js
CHANGED
|
@@ -129,7 +129,18 @@ class Appit {
|
|
|
129
129
|
{
|
|
130
130
|
let homescreen = this.transformer.homescreen()
|
|
131
131
|
if(homescreen) {
|
|
132
|
-
|
|
132
|
+
if(homescreen.hasOwnProperty('lang_homescreen') && Array.isArray(homescreen.lang_homescreen)) {
|
|
133
|
+
let data = JSON.parse(JSON.stringify(homescreen));
|
|
134
|
+
for(let i = 0; i < homescreen.lang_homescreen.length; i++) {
|
|
135
|
+
let current = homescreen.lang_homescreen[i];
|
|
136
|
+
let lang = (current.hasOwnProperty('lang')) ? current.lang : 'nl';
|
|
137
|
+
if(current.hasOwnProperty('lang')) delete current.lang;
|
|
138
|
+
data.lang_homescreen = current;
|
|
139
|
+
await this.saveHomescreen(data, lang);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
await this.saveHomescreen(homescreen, 'nl');
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
146
|
|
|
@@ -660,9 +671,10 @@ class Appit {
|
|
|
660
671
|
return Promise.all(promises);
|
|
661
672
|
}
|
|
662
673
|
|
|
663
|
-
async request(method, path, data)
|
|
674
|
+
async request(method, path, data, lang)
|
|
664
675
|
{
|
|
665
676
|
const payload = (data) ? JSON.stringify(data).toString("utf8") : false;
|
|
677
|
+
if(!lang) lang = 'nl';
|
|
666
678
|
await this.sleep(500);
|
|
667
679
|
|
|
668
680
|
return new Promise((resolve, reject) => {
|
|
@@ -679,7 +691,7 @@ class Appit {
|
|
|
679
691
|
if(payload) {
|
|
680
692
|
options.headers = {
|
|
681
693
|
'Content-Type': 'application/json',
|
|
682
|
-
'Content-Language':
|
|
694
|
+
'Content-Language': lang
|
|
683
695
|
};
|
|
684
696
|
}
|
|
685
697
|
|
|
@@ -1135,9 +1147,9 @@ class Appit {
|
|
|
1135
1147
|
return await this.request('PUT', `excursions/${this.history.excursionId}/save_menu_settings`, data);
|
|
1136
1148
|
}
|
|
1137
1149
|
|
|
1138
|
-
async saveHomescreen(data)
|
|
1150
|
+
async saveHomescreen(data, lang)
|
|
1139
1151
|
{
|
|
1140
|
-
return await this.request('PUT', `excursions/${this.history.excursionId}/homescreen/save_setting`, data);
|
|
1152
|
+
return await this.request('PUT', `excursions/${this.history.excursionId}/homescreen/save_setting`, data, lang);
|
|
1141
1153
|
}
|
|
1142
1154
|
|
|
1143
1155
|
async saveSettings(workspace_id, data)
|