Skip to content

Commit 4426af7

Browse files
committed
keep query-parameters when changing page size
1 parent ba3f8f9 commit 4426af7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin
99
## [unreleased]
1010

1111
- add `tags` to all routes
12+
- fix `collections` and `items` HTML templates to keep query-parameters when changing the `page size`
1213

1314
## [0.5.6] - 2023-12-19
1415

tipg/templates/collections.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ <h1>Collections</h1>
7575
<script>
7676
function changePageSize() {
7777
var url = "{{ template.api_root }}/collections?";
78-
url += "limit=" + $("#limit").val();
78+
const searchParams = new URLSearchParams(window.location.search);
79+
searchParams.set('limit', $("#limit").val());
80+
url += searchParams.toString();
7981
window.location.href = url;
8082
}
8183
$(function() {

tipg/templates/items.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ <h1>Collection Items: {{ response.title or response.id }}</h1>
7777
</div>
7878

7979
<script>
80-
var currentURL = "{{ template.api_root }}/collections/{{ response.id }}/items"
80+
var currentURL = "{{ template.api_root }}/collections/{{ response.id }}/items"
8181
function changePageSize() {
8282
var url = "{{ template.api_root }}/collections/{{ response.id }}/items?";
83-
url += "limit=" + $("#limit").val();
83+
const searchParams = new URLSearchParams(window.location.search);
84+
searchParams.set('limit', $("#limit").val());
85+
url += searchParams.toString();
8486
window.location.href = url;
8587
}
8688
$(function() {

0 commit comments

Comments
 (0)