Skip to content

Commit

Permalink
Use browser APIs for URL manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Aug 29, 2023
1 parent ded7f80 commit c2ac152
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions view/adminhtml/templates/grid.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,11 @@ $rows = $grid->getRows();
},

getFormUriEncoded(form) {
const url = form.action;
const encodedFields = Array.from(form.elements)
.map(input => encodeURIComponent(input.name) + '=' + encodeURIComponent(input.value))
.join('&');
return url + (url.includes('?') ? '&' : '?') + encodedFields;
const url = new URL(form.action);
Array.from(form.elements).forEach(
input => url.searchParams.set(input.name, input.value)
);
return url.toString();
},

updateGrid(url) {
Expand Down

0 comments on commit c2ac152

Please sign in to comment.