diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-07 00:35:07 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-07 00:35:07 +0300 |
| commit | 1898db985f708f0ff54d04d2d77303c633bc1ba2 (patch) | |
| tree | f608db9059478d72673149a30dd5bfb650b1e025 /web/js/api.js | |
| parent | 9458bf6d9861a6e09c616c8d290cce56fc61ac9f (diff) | |
Fix podcast episode pagination arguments (p0)
Diffstat (limited to 'web/js/api.js')
| -rw-r--r-- | web/js/api.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/web/js/api.js b/web/js/api.js index deabf20..28954a1 100644 --- a/web/js/api.js +++ b/web/js/api.js @@ -86,7 +86,20 @@ export const API = { delPermissions: (body) => api('/api/admin/permissions', { method: 'DELETE', body }), rescan: () => api('/api/admin/rescan', { method: 'POST' }), podcasts: () => api('/api/podcasts'), - podcastEpisodes: (setId, limit = 50, offset = 0) => { + podcastEpisodes: (setId, pagination, legacyOffset) => { + let limit = 50; + let offset = 0; + if (typeof pagination === 'number') { + if (typeof legacyOffset === 'number') { + limit = pagination; + offset = legacyOffset; + } else { + offset = pagination; + } + } else if (pagination) { + limit = pagination.limit ?? limit; + offset = pagination.offset ?? offset; + } const params = new URLSearchParams({ limit, offset }); return api(`/api/podcasts/${setId}/episodes?${params}`); }, |
