Skip to content

Commit 6287388

Browse files
committed
refactor: URLsearchParams
1 parent e79128e commit 6287388

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/platform/remote/comfyui/history/fetchers/fetchHistoryV1.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ export async function fetchHistoryV1(
3131
)
3232
}
3333

34-
let url = `/history?max_items=${maxItems}`
34+
const params = new URLSearchParams({ max_items: maxItems.toString() })
3535
if (offset !== undefined) {
36-
url += `&offset=${offset}`
36+
params.set('offset', offset.toString())
3737
}
38+
const url = `/history?${params.toString()}`
3839
const res = await fetchApi(url)
3940
const json: Record<
4041
string,

src/platform/remote/comfyui/history/fetchers/fetchHistoryV2.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ export async function fetchHistoryV2(
3030
)
3131
}
3232

33-
let url = `/history_v2?max_items=${maxItems}`
33+
const params = new URLSearchParams({ max_items: maxItems.toString() })
3434
if (offset !== undefined) {
35-
url += `&offset=${offset}`
35+
params.set('offset', offset.toString())
3636
}
37+
const url = `/history_v2?${params.toString()}`
3738
const res = await fetchApi(url)
3839
const rawData: HistoryResponseV2 = await res.json()
3940
const adaptedHistory = mapHistoryV2toHistory(rawData)

0 commit comments

Comments
 (0)