Skip to content

Commit

Permalink
fix: add the correct way to get the paginated content for datasources
Browse files Browse the repository at this point in the history
  • Loading branch information
ademarCardoso committed Aug 8, 2023
1 parent a2de721 commit 4c08b4c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tasks/sync-commands/datasources.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class SyncDatasources {
const entriesFirstPage = await this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}${dimensionQuery}`)
const entriesRequets = []
for (let i = 2; i <= Math.ceil(entriesFirstPage.total / 25); i++) {
entriesRequets.push(this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}`, { page: i }))
entriesRequets.push(await this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}&page=${i}`))
}
return entriesFirstPage.data.datasource_entries.concat(...(await Promise.all(entriesRequets)).map(r => r.data.datasource_entries))
} catch (err) {
Expand Down

0 comments on commit 4c08b4c

Please sign in to comment.