muba-posting 4.1.2 → 4.1.5

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.
@@ -22,7 +22,7 @@ export default class PopupSpendProduct extends React.Component {
22
22
 
23
23
  async componentDidMount() {
24
24
  const resultJson = await this.props.request(this, COUNTRY_PHONE);
25
- if (resultJson.status === 200) {
25
+ if (resultJson.httpStatus === 200) {
26
26
  this.setState({ countryPhone: resultJson.list[0].formattedPhone });
27
27
  }
28
28
  }
@@ -42,7 +42,7 @@ export default class PopupSpendProduct extends React.Component {
42
42
  });
43
43
 
44
44
  this.props.hideLoading();
45
- if (responseJson.status === 200 && responseJson.remaining >= -1) {
45
+ if (responseJson.httpStatus === 200 && responseJson.remaining >= -1) {
46
46
  if (responseJson.remaining > -1) {
47
47
  result = 1;
48
48
  }
@@ -65,7 +65,7 @@ export default class PopupSpendProduct extends React.Component {
65
65
  });
66
66
 
67
67
  this.props.hideLoading();
68
- if (responseJson.status === 200 && responseJson.remaining >= -1) {
68
+ if (responseJson.httpStatus === 200 && responseJson.remaining >= -1) {
69
69
  if (responseJson.remaining > -1) {
70
70
  result = 1;
71
71
  }
package/Posting.js CHANGED
@@ -183,8 +183,8 @@ export default class Posting extends React.Component {
183
183
 
184
184
  loadData = async (canPublish) => {
185
185
  if (canPublish) {
186
- const resultJson = await this.props.request(this, COUNTRY_PHONE, { code: this.props.country });
187
- if (resultJson.status === 200) {
186
+ const resultJson = await this.props.request(this, COUNTRY_PHONE);
187
+ if (resultJson.httpStatus === 200) {
188
188
  this.setState({ countryPhone: resultJson.list[0].formattedPhone });
189
189
  }
190
190
 
@@ -228,24 +228,26 @@ export default class Posting extends React.Component {
228
228
  }
229
229
 
230
230
  async checkListings() {
231
- const response = await this.props.request(this, BUSINESS_PRODUCTS, { key: 'LISTING' });
232
- return response > 0;
231
+ const responseJson = await this.props.request(this, BUSINESS_PRODUCTS, { key: 'LISTING' });
232
+ return responseJson.value > 0;
233
233
  }
234
234
 
235
235
  async readBusinessId() {
236
- const response = await this.props.request(this, BUSINESS_ID, { userId: this.props.userId });
237
- if (response.status !== 404) {
236
+ const responseJson = await this.props.request(this, BUSINESS_ID, { userId: this.props.userId });
237
+ if (responseJson.httpStatus === 200) {
238
238
  this.setState({
239
- businessId: response
239
+ businessId: responseJson.value
240
240
  });
241
241
  }
242
242
  }
243
243
 
244
244
  async getMaxPictures() {
245
- const response = await this.props.request(this, MAX_PICTURES, {});
246
- this.setState({
247
- maxPictures: response
248
- })
245
+ const responseJson = await this.props.request(this, MAX_PICTURES);
246
+ if (responseJson.httpStatus === 200) {
247
+ this.setState({
248
+ maxPictures: responseJson.value
249
+ })
250
+ }
249
251
  }
250
252
 
251
253
  async loadAd() {
@@ -263,7 +265,7 @@ export default class Posting extends React.Component {
263
265
 
264
266
  if (!this.state.postingAd.id && this.state.postingAd.town) {
265
267
  const response = await this.props.request(this, CREATE_AD, this.state.postingAd);
266
- if (response.status === 200) {
268
+ if (response.httpStatus === 200) {
267
269
  await this.setState({
268
270
  postingAd: { ...this.state.postingAd, id: response.id }
269
271
  })
package/Publish1.js CHANGED
@@ -34,10 +34,10 @@ export default class Publish1 extends React.Component {
34
34
  userId: this.props.postingAd.userId
35
35
  });
36
36
 
37
- if (responseJson.status === 200) {
37
+ if (responseJson.httpStatus === 200) {
38
38
  this.jsonCategories = responseJson.list;
39
39
  this.props.postingAd.category = this.props.postingAd.category != null ? this.props.postingAd.category : this.jsonCategories[0].value;
40
- this.props.postingAd.subCategory = this.props.postingAd.subCategory != null ? this.props.postingAd.subCategory : this.jsonCategories[0].subCategoryList[0].value;
40
+ this.props.postingAd.subCategory = this.props.postingAd.subCategory != null ? this.props.postingAd.subCategory : this.jsonCategories[0].subList[0].value;
41
41
 
42
42
  await this.setState({
43
43
  transactionOptions: { elements: this.jsonCategories.map(jsonCategory => { return { label: jsonCategory.label, value: jsonCategory.value } }), selectedItem: this.props.postingAd.category },
@@ -68,7 +68,7 @@ export default class Publish1 extends React.Component {
68
68
  getSubCategories(category) {
69
69
  return this.jsonCategories?.find((categoryJson) =>
70
70
  categoryJson.value === category
71
- ).subCategoryList;
71
+ ).subList;
72
72
  }
73
73
 
74
74
  async changeCategory(category) {
@@ -108,7 +108,7 @@ export default class Publish1 extends React.Component {
108
108
  if (this.validateForm()) {
109
109
  for (var i = 0; i < this.state.typeBienOptions.elements.length; i++) {
110
110
  if (this.state.typeBienOptions.elements[i].value == this.state.typeBienOptions.selectedItem) {
111
- this.props.postingAd.subCategoryDetails = this.state.typeBienOptions.elements[i].detailList;
111
+ this.props.postingAd.subCategoryDetails = this.state.typeBienOptions.elements[i].subList;
112
112
  break;
113
113
  }
114
114
  }
package/Publish2.js CHANGED
@@ -62,7 +62,7 @@ export default class Publish2 extends React.Component {
62
62
  longitude: this.props.postingAd.longitude
63
63
  });
64
64
 
65
- if (responseJson.success) {
65
+ if (responseJson.httpStatus === 200) {
66
66
  if (responseJson.exactlyLocated) {
67
67
  this.props.postingAd.exactlyLocated = true;
68
68
  validateLocation = true;
package/Publish2b.js CHANGED
@@ -94,7 +94,7 @@ export default class Publish2b extends React.Component {
94
94
  if (this.state.regionOptions.elements.length <= 1) {
95
95
  const responseJson = await this.props.request(this.props.context, GET_REGIONS, {});
96
96
 
97
- if (responseJson.status === 200) {
97
+ if (responseJson.httpStatus === 200) {
98
98
  const regionOptions = {
99
99
  elements: [this.state.regionOptions.elements[0]],
100
100
  selectedItem: this.props.postingAd.region
@@ -120,7 +120,7 @@ export default class Publish2b extends React.Component {
120
120
  regionId: this.props.postingAd.region
121
121
  });
122
122
 
123
- if (responseJson.status === 200) {
123
+ if (responseJson.httpStatus === 200) {
124
124
  var cityOptions = {
125
125
  elements: [this.state.cityOptions.elements[0]],
126
126
  selectedItem: null
@@ -157,7 +157,7 @@ export default class Publish2b extends React.Component {
157
157
  cityId: this.props.postingAd.city
158
158
  });
159
159
 
160
- if (responseJson.status === 200) {
160
+ if (responseJson.httpStatus === 200) {
161
161
  let districtOptions = {
162
162
  elements: [this.state.districtOptions.elements[0]],
163
163
  selectedItem: null
@@ -199,7 +199,7 @@ export default class Publish2b extends React.Component {
199
199
  districtId: this.props.postingAd.district
200
200
  });
201
201
 
202
- if (responseJson.status === 200) {
202
+ if (responseJson.httpStatus === 200) {
203
203
  var townOptions = {
204
204
  elements: [this.state.townOptions.elements[0]],
205
205
  selectedItem: null
package/Publish3.js CHANGED
@@ -64,7 +64,7 @@ export default class Publish3 extends React.Component {
64
64
  const responseJson = await this.props.request(this.props.context, GET_CURRENCIES, {});
65
65
  const priceOptions = this.state.priceOptions;
66
66
 
67
- if (responseJson.status === 200) {
67
+ if (responseJson.httpStatus === 200) {
68
68
  responseJson.list.map((item) => {
69
69
  priceOptions.elements.push(item);
70
70
  });
package/Publish6.js CHANGED
@@ -78,7 +78,7 @@ export default class Publish6 extends React.Component {
78
78
  delete ad.images;
79
79
  const responseJson = await this.props.request(this.props.context, GENERATE_TITLE_DESCRIPTION, ad);
80
80
 
81
- if (responseJson?.status === 200) {
81
+ if (responseJson?.httpStatus === 200) {
82
82
  if (this.props.postingAd.languages[0].title === undefined || this.props.postingAd.languages[0].title === null) {
83
83
  this.props.postingAd.languages[0].title = responseJson.title;
84
84
  }
@@ -127,8 +127,8 @@ export default class Publish6 extends React.Component {
127
127
 
128
128
  this.setState({ loading: true });
129
129
 
130
- const phoneFree = await this.props.request(this.props.context, PHONE_REGISTERED, body);
131
- validate = phoneFree && validate;
130
+ const responseJson = await this.props.request(this.props.context, PHONE_REGISTERED, body);
131
+ validate = responseJson.value === 'true' && validate;
132
132
  this.setState({ existingPhoneError: !phoneFree });
133
133
 
134
134
  this.languageItem.forEach(element => validate = element.validateLanguageItem() && validate);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muba-posting",
3
- "version": "4.1.2",
3
+ "version": "4.1.5",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {