muba-posting 6.0.17 → 6.0.19
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/Posting.js +13 -3
- package/Publish2b.js +8 -2
- package/package.json +1 -1
package/Posting.js
CHANGED
|
@@ -228,9 +228,6 @@ export default class Posting extends React.Component {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
this._hideLoading()
|
|
231
|
-
this.props.request(this.props.context, LOAD_LOCATIONS, { regions: true, cities: true, districts: true, towns: true }).then(data => {
|
|
232
|
-
this.setState({ locationList: data.list });
|
|
233
|
-
});
|
|
234
231
|
BackHandler.addEventListener('hardwareBackPress', this.goBack);
|
|
235
232
|
} else {
|
|
236
233
|
this.goBack();
|
|
@@ -330,6 +327,9 @@ export default class Posting extends React.Component {
|
|
|
330
327
|
this.setState({ currentScreen: 1 });
|
|
331
328
|
break;
|
|
332
329
|
case Views.PUBLISH_2:
|
|
330
|
+
if (this.state.locationList.length === 0) {
|
|
331
|
+
this.loadLocations();
|
|
332
|
+
}
|
|
333
333
|
this.setState({ currentScreen: 2 });
|
|
334
334
|
break;
|
|
335
335
|
case Views.PUBLISH_2_B:
|
|
@@ -441,6 +441,15 @@ export default class Posting extends React.Component {
|
|
|
441
441
|
return responseJson;
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
loadLocations = async () => {
|
|
445
|
+
this._showLoading();
|
|
446
|
+
return this.props.request(this.props.context, LOAD_LOCATIONS, { regions: true, cities: true, districts: true, towns: true }).then(data => {
|
|
447
|
+
this.setState({ locationList: data.list });
|
|
448
|
+
this._hideLoading();
|
|
449
|
+
return data.list;
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
444
453
|
render() {
|
|
445
454
|
return (
|
|
446
455
|
<View style={commonStyles.flex1}>
|
|
@@ -507,6 +516,7 @@ export default class Posting extends React.Component {
|
|
|
507
516
|
context={this.props.context}
|
|
508
517
|
showLoading={() => this._showLoading()}
|
|
509
518
|
hideLoading={() => this._hideLoading()}
|
|
519
|
+
loadLocations={this.loadLocations}
|
|
510
520
|
fullPosting={this.state.fullPosting}
|
|
511
521
|
businessId={this.state.businessId}
|
|
512
522
|
locationList={this.state.locationList} />
|
package/Publish2b.js
CHANGED
|
@@ -11,6 +11,7 @@ import fontelloConfig from './fonts/config.json';
|
|
|
11
11
|
const FontAwesomeIcon = createIconSetFromFontello(fontelloConfig);
|
|
12
12
|
|
|
13
13
|
const GET_CHECK_ZONE = { method: 'GET', url: '/controller/posting/check-zone' };
|
|
14
|
+
const LOAD_LOCATIONS = { method: 'GET', url: '/controller/countries/{countryCode}/locations' };
|
|
14
15
|
|
|
15
16
|
export default class Publish2b extends React.Component {
|
|
16
17
|
constructor(props) {
|
|
@@ -42,7 +43,12 @@ export default class Publish2b extends React.Component {
|
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
componentDidMount = () => {
|
|
46
|
+
componentDidMount = async () => {
|
|
47
|
+
if (this.state.locationsList.length === 0) {
|
|
48
|
+
this.setState({
|
|
49
|
+
locationsList: await this.props.loadLocations()
|
|
50
|
+
});
|
|
51
|
+
}
|
|
46
52
|
this.loadData();
|
|
47
53
|
}
|
|
48
54
|
|
|
@@ -148,7 +154,7 @@ export default class Publish2b extends React.Component {
|
|
|
148
154
|
}
|
|
149
155
|
|
|
150
156
|
async nextStep() {
|
|
151
|
-
if (this.validateForm()) {
|
|
157
|
+
if (await this.validateForm()) {
|
|
152
158
|
const responseCheckZone = await this.props.request(this.props.context, GET_CHECK_ZONE, {
|
|
153
159
|
businessId: this.props.businessId,
|
|
154
160
|
cityId: this.props.postingAd.city
|