innoboxrr-vue-datatable 1.0.3 → 1.1.0
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/package.json +1 -1
- package/src/DataTable.vue +22 -8
package/package.json
CHANGED
package/src/DataTable.vue
CHANGED
|
@@ -182,6 +182,11 @@
|
|
|
182
182
|
required: true
|
|
183
183
|
},
|
|
184
184
|
|
|
185
|
+
dataMethod: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: 'post',
|
|
188
|
+
},
|
|
189
|
+
|
|
185
190
|
model: {
|
|
186
191
|
type: Object,
|
|
187
192
|
required: true
|
|
@@ -335,30 +340,40 @@
|
|
|
335
340
|
},
|
|
336
341
|
|
|
337
342
|
fetchData() {
|
|
343
|
+
|
|
344
|
+
const requestData = {
|
|
345
|
+
|
|
346
|
+
method: this.dataMethod,
|
|
347
|
+
|
|
348
|
+
url: this.dataUrl,
|
|
349
|
+
|
|
350
|
+
data: this.dataMethod === 'post' ? this.getFilters() : null,
|
|
338
351
|
|
|
339
|
-
|
|
352
|
+
params: this.dataMethod === 'get' ? this.getFilters() : null
|
|
353
|
+
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
axios(requestData).then(res => {
|
|
340
357
|
|
|
341
358
|
this.fetchDataAttempts = 0;
|
|
342
359
|
|
|
343
360
|
this.dataTable.body = res.data.data;
|
|
344
|
-
|
|
361
|
+
|
|
345
362
|
this.pagination.meta = res.data.meta;
|
|
346
363
|
|
|
347
364
|
this.pagination.links = res.data.links;
|
|
348
365
|
|
|
349
366
|
}).catch(error => {
|
|
350
367
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if(error.response.status == 403) {
|
|
368
|
+
if (error.response.status === 403) {
|
|
354
369
|
|
|
355
370
|
// this.$router.push({name: "NotAuthorized" });
|
|
356
371
|
|
|
357
372
|
} else {
|
|
358
373
|
|
|
359
|
-
if(this.fetchDataAttempts <= 3) {
|
|
374
|
+
if (this.fetchDataAttempts <= 3) {
|
|
360
375
|
|
|
361
|
-
setTimeout(
|
|
376
|
+
setTimeout(() => {
|
|
362
377
|
|
|
363
378
|
++this.fetchDataAttempts;
|
|
364
379
|
|
|
@@ -371,7 +386,6 @@
|
|
|
371
386
|
}
|
|
372
387
|
|
|
373
388
|
});
|
|
374
|
-
|
|
375
389
|
},
|
|
376
390
|
|
|
377
391
|
getFilters() {
|