muba-posting 4.1.1 → 4.1.4

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 CHANGED
@@ -28,7 +28,7 @@ const FontAwesomeIcon = createIconSetFromFontello(fontelloConfig);
28
28
 
29
29
  const CREATE_AD = { method: 'POST', url: '/controller/ads' };
30
30
  const UPDATE_AD = { method: 'PUT', url: '/controller/ads/{adId}' };
31
- const AD = { method: 'GET', url: '/controller/ads/{adId}' };
31
+ const AD = { method: 'GET', url: '/controller/ads/{adId}/posting' };
32
32
  const BUSINESS_ID = { method: 'GET', url: '/controller/users/{userId}/businessId' };
33
33
  const BUSINESS_PRODUCTS = { method: 'GET', url: '/controller/products/{key}/remaining' };
34
34
  const MAX_PICTURES = { method: 'GET', url: '/controller/max-pictures' };
@@ -183,7 +183,7 @@ 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 });
186
+ const resultJson = await this.props.request(this, COUNTRY_PHONE);
187
187
  if (resultJson.status === 200) {
188
188
  this.setState({ countryPhone: resultJson.list[0].formattedPhone });
189
189
  }
@@ -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.status === 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.status === 200) {
247
+ this.setState({
248
+ maxPictures: responseJson.value
249
+ })
250
+ }
249
251
  }
250
252
 
251
253
  async loadAd() {
package/Publish1.js CHANGED
@@ -37,7 +37,7 @@ export default class Publish1 extends React.Component {
37
37
  if (responseJson.status === 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.status === 200) {
66
66
  if (responseJson.exactlyLocated) {
67
67
  this.props.postingAd.exactlyLocated = true;
68
68
  validateLocation = true;
package/Publish6.js CHANGED
@@ -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.1",
3
+ "version": "4.1.4",
4
4
  "description": "Posting",
5
5
  "main": "Posting.js",
6
6
  "scripts": {