@dile/crud 2.8.6 → 2.8.8

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.
@@ -80,7 +80,7 @@ export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) {
80
80
  }
81
81
  this.dispatchEvent(new CustomEvent('ajax-success', { detail }));
82
82
  } else {
83
- this.dispatchError(this.translations.http_unhandled_success, response.data);
83
+ this.dispatchError(this.translations.http_unhandled_success, response.data, [], response.status);
84
84
  }
85
85
  })
86
86
  .catch(async err => {
@@ -112,50 +112,51 @@ export class DileAjax extends DileAxios(DileI18nMixin(LitElement)) {
112
112
  const status = res.status;
113
113
  switch (status) {
114
114
  case 422:
115
- this.dispatchError(res.data.message || this.translations.http_422, res.data, this.getValidationErrors(res.data));
115
+ this.dispatchError(res.data.message || this.translations.http_422, res.data, this.getValidationErrors(res.data), status);
116
116
  break;
117
117
  case 400:
118
- this.dispatchError(res.data.message || this.translations.http_400, res.data, this.getValidationErrors(res.data));
118
+ this.dispatchError(res.data.message || this.translations.http_400, res.data, this.getValidationErrors(res.data), status);
119
119
  break;
120
120
  case 404:
121
- this.dispatchError(res.data.message || this.translations.http_404, res.data);
121
+ this.dispatchError(res.data.message || this.translations.http_404, res.data, [], status);
122
122
  break;
123
123
  case 401:
124
- this.dispatchError(res.data.message || this.translations.http_401, res.data);
124
+ this.dispatchError(res.data.message || this.translations.http_401, res.data, [], status);
125
125
  break;
126
126
  case 403:
127
- this.dispatchError(res.data.message || this.translations.http_403, res.data);
127
+ this.dispatchError(res.data.message || this.translations.http_403, res.data, [], status);
128
128
  break;
129
129
  case 405:
130
- this.dispatchError(res.data.message || this.translations.http_405, res.data);
130
+ this.dispatchError(res.data.message || this.translations.http_405, res.data, [], status);
131
131
  break;
132
132
  case 413:
133
- this.dispatchError(res.data.message || this.translations.http_413, res.data);
133
+ this.dispatchError(res.data.message || this.translations.http_413, res.data, [], status);
134
134
  break;
135
135
  case 419:
136
- this.dispatchError(res.data.message || this.translations.http_419, res.data);
136
+ this.dispatchError(res.data.message || this.translations.http_419, res.data, [], status);
137
137
  break;
138
138
  case 502:
139
- this.dispatchError(res.data.message || this.translations.http_502, res.data);
139
+ this.dispatchError(res.data.message || this.translations.http_502, res.data, [], status);
140
140
  break;
141
141
  case 504:
142
- this.dispatchError(res.data.message || this.translations.http_504, res.data);
142
+ this.dispatchError(res.data.message || this.translations.http_504, res.data, [], status);
143
143
  break;
144
144
  default:
145
- this.dispatchError(res.data.message || this.translations.http_other_error, res.data);
145
+ this.dispatchError(res.data.message || this.translations.http_other_error, res.data, [], status);
146
146
  }
147
147
  } else {
148
148
  this.dispatchRawError(err, null);
149
- this.dispatchError(this.translations.http_no_response, {});
149
+ this.dispatchError(this.translations.http_no_response, {}, [], null);
150
150
  }
151
151
  }
152
152
 
153
- dispatchError(message, data, errors = []) {
153
+ dispatchError(message, data, errors = [], status = null) {
154
154
  this.dispatchEvent(new CustomEvent('ajax-error', {
155
155
  detail: {
156
156
  message,
157
157
  data,
158
- errors
158
+ errors,
159
+ status
159
160
  }
160
161
  }));
161
162
  }
@@ -96,7 +96,7 @@ describe('dile-crud-sort-form', () => {
96
96
  let receivedDetail = null;
97
97
  el.addEventListener('sort-changed', (e) => { receivedDetail = e.detail; });
98
98
 
99
- el.shadowRoot.querySelector('dile-order-switch[name="year"]').shadowRoot.querySelector('span').click();
99
+ el.shadowRoot.querySelector('dile-order-switch[name="year"]').shadowRoot.querySelector('a').click();
100
100
  await el.updateComplete;
101
101
 
102
102
  expect(el.sortField).toBe('year');
@@ -117,7 +117,7 @@ describe('dile-crud-sort-form', () => {
117
117
  let receivedDetail = null;
118
118
  el.addEventListener('sort-changed', (e) => { receivedDetail = e.detail; });
119
119
 
120
- const label = () => el.shadowRoot.querySelector('dile-order-switch[name="name"]').shadowRoot.querySelector('span');
120
+ const label = () => el.shadowRoot.querySelector('dile-order-switch[name="name"]').shadowRoot.querySelector('a');
121
121
 
122
122
  label().click();
123
123
  await el.updateComplete;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "2.8.6",
3
+ "version": "2.8.8",
4
4
  "description": "Components to create a generic crud system based on Web Components and Lit",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,12 +25,12 @@
25
25
  },
26
26
  "homepage": "https://dile-components.com/",
27
27
  "dependencies": {
28
- "@dile/ui": "^3.13.1",
28
+ "@dile/ui": "^3.15.0",
29
29
  "axios": "^1.19.0",
30
30
  "lit": "^2.7.0 || ^3.0.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "3510698d9d112dfade5e333998a406d5a4c8a303"
35
+ "gitHead": "5ef91e1892e270fade848c64082184fa3fbddb53"
36
36
  }