Skip to content

Commit 32a2bed

Browse files
fix: searchParams variable add in local scope from global scope
1 parent 788773b commit 32a2bed

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/datatable.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Import the axios instance from the local file "./axios"
22
import axios from "./axios"
33

4-
// Parse the search parameters from the URL
5-
let searchParams = new URLSearchParams(window.location.search)
6-
74
class datatable {
85
constructor() {
96

107
}
118

129
// Method to perform a GET request
1310
async get(url) {
11+
// Parse the search parameters from the URL
12+
let searchParams = new URLSearchParams(window.location.search)
13+
1414
// Retrieve values from search parameters
1515
let page = searchParams.get('page')
1616
let paginate = searchParams.get('paginate')
@@ -34,6 +34,9 @@ class datatable {
3434

3535
// Method to perform a POST request
3636
async post(url) {
37+
// Parse the search parameters from the URL
38+
let searchParams = new URLSearchParams(window.location.search)
39+
3740
// Retrieve values from search parameters
3841
let page = searchParams.get('page')
3942
let paginate = searchParams.get('paginate')
@@ -57,6 +60,9 @@ class datatable {
5760

5861
// Method to perform a PUT request
5962
async put(url) {
63+
// Parse the search parameters from the URL
64+
let searchParams = new URLSearchParams(window.location.search)
65+
6066
// Retrieve values from search parameters
6167
let page = searchParams.get('page')
6268
let paginate = searchParams.get('paginate')

0 commit comments

Comments
 (0)