@dile/crud 1.5.1 → 1.5.3

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.
@@ -33,6 +33,10 @@ export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) {
33
33
 
34
34
  generateRequest() {
35
35
  let request;
36
+ this.dispatchEvent(new CustomEvent('dile-ajax-request-start', {
37
+ bubbles: true,
38
+ composed: true
39
+ }));
36
40
  if(this.sendDataAsFormData) {
37
41
  this._prepareFormData();
38
42
  }
@@ -70,6 +74,10 @@ export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) {
70
74
  })
71
75
  .finally(() => {
72
76
  this.formData = null;
77
+ this.dispatchEvent(new CustomEvent('dile-ajax-request-end', {
78
+ bubbles: true,
79
+ composed: true
80
+ }));
73
81
  });
74
82
  }
75
83
 
@@ -87,35 +95,31 @@ export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) {
87
95
  this.dispatchError(res.data.message || this.translations.http_400, res.data, this.getValidationErrors(res.data));
88
96
  break;
89
97
  case 404:
90
- if(res.data.message) {
91
- this.dispatchError(res.data.message, res.data);
92
- } else {
93
- this.dispatchError(this.translations.http_404, res.data);
94
- }
98
+ this.dispatchError(res.data.message || this.translations.http_404, res.data);
95
99
  break;
96
100
  case 401:
97
- this.dispatchError(this.translations.http_401, res.data);
101
+ this.dispatchError(res.data.message || this.translations.http_401, res.data);
98
102
  break;
99
103
  case 403:
100
- this.dispatchError(this.translations.http_403, res.data);
104
+ this.dispatchError(res.data.message || this.translations.http_403, res.data);
101
105
  break;
102
106
  case 405:
103
- this.dispatchError(this.translations.http_405, res.data);
107
+ this.dispatchError(res.data.message || this.translations.http_405, res.data);
104
108
  break;
105
109
  case 413:
106
- this.dispatchError(this.translations.http_413, res.data);
110
+ this.dispatchError(res.data.message || this.translations.http_413, res.data);
107
111
  break;
108
112
  case 419:
109
- this.dispatchError(this.translations.http_419, res.data);
113
+ this.dispatchError(res.data.message || this.translations.http_419, res.data);
110
114
  break;
111
115
  case 502:
112
- this.dispatchError(this.translations.http_502, res.data);
116
+ this.dispatchError(res.data.message || this.translations.http_502, res.data);
113
117
  break;
114
118
  case 504:
115
- this.dispatchError(this.translations.http_504, res.data);
119
+ this.dispatchError(res.data.message || this.translations.http_504, res.data);
116
120
  break;
117
121
  default:
118
- this.dispatchError(this.translations.http_other_error, res.data);
122
+ this.dispatchError(res.data.message || this.translations.http_other_error, res.data);
119
123
  }
120
124
  } else {
121
125
  this.dispatchError(this.translations.http_no_response, {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Components to create a generic crud system based on Web Components and Lit",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "8fb4049d780b8cbd0b8a74296fd9983d499f9d4d"
34
+ "gitHead": "0d71120f99b23375930d042130aecbf95ffe8602"
35
35
  }