innoboxrr-vue-datatable 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/DataTable.vue +23 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "innoboxrr-vue-datatable",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Datatable para vue3",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/DataTable.vue CHANGED
@@ -473,24 +473,37 @@
473
473
 
474
474
  actionButtonClicked(actions) {
475
475
 
476
- // Recuperar el id
477
- let id = actions[0].params.id;
476
+ const id = actions[0].params.id;
478
477
 
479
- axios.post(this.policyUrl, {
478
+ const requestData = {
480
479
 
481
480
  _token: csrf_token,
482
481
 
483
482
  id: id
484
483
 
485
- }).then(res => {
484
+ };
485
+
486
+ const requestConfig = {
487
+
488
+ method: this.policyMethod,
489
+
490
+ url: this.policyUrl,
491
+
492
+ data: this.policyMethod === 'post' ? requestData : null,
493
+
494
+ params: this.policyMethod === 'get' ? requestData : null
495
+
496
+ };
497
+
498
+ axios(requestConfig).then(res => {
486
499
 
487
500
  this.fetchPoliciesAttempts = 0;
488
501
 
489
- let policies = res.data;
502
+ const policies = res.data;
490
503
 
491
- actions.forEach( action => {
504
+ actions.forEach(action => {
492
505
 
493
- if(policies[action.id]) {
506
+ if (policies[action.id]) {
494
507
 
495
508
  action.policy = true;
496
509
 
@@ -500,9 +513,9 @@
500
513
 
501
514
  }).catch(error => {
502
515
 
503
- if(this.fetchPoliciesAttempts <= 3) {
516
+ if (this.fetchPoliciesAttempts <= 3) {
504
517
 
505
- setTimeout( () => {
518
+ setTimeout(() => {
506
519
 
507
520
  ++this.fetchPoliciesAttempts;
508
521
 
@@ -512,7 +525,7 @@
512
525
 
513
526
  } else {
514
527
 
515
- setTimeout( () => {
528
+ setTimeout(() => {
516
529
 
517
530
  this.fetchPoliciesAttempts = 0;
518
531