Skip to content

Commit

Permalink
added a limit of 300 to avoid pagination on api
Browse files Browse the repository at this point in the history
  • Loading branch information
alesanchezr committed Aug 19, 2022
1 parent 57747a9 commit 3b7bcdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,23 @@ class Wrapper {
let url = this.options.apiPathV2;
return {
all: syllabus_slug => {
return this.get(url + "/registry/asset?type=project&language=us&visibility=PUBLIC,UNLISTED");
return this.get(url + "/registry/asset?limit=300&type=project&language=us&visibility=PUBLIC,UNLISTED");
}
};
}
replit() {
let url = this.options.apiPathV2;
return {
all: () => {
return this.get(url + "/registry/asset?type=exercise&language=us&external=both&visibility=PUBLIC,UNLISTED");
return this.get(url + "/registry/asset?limit=300&type=exercise&language=us&external=both&visibility=PUBLIC,UNLISTED");
}
};
}
quiz() {
let url = this.options.apiPathV2;
return {
all: () => {
return this.get(url + "/registry/asset?type=quiz&language=us&visibility=PUBLIC,UNLISTED");
return this.get(url + "/registry/asset?limit=300&type=quiz&language=us&visibility=PUBLIC,UNLISTED");
}
};
}
Expand Down Expand Up @@ -419,7 +419,7 @@ class Wrapper {
let url = this.options.apiPathV2;
return {
all: () => {
return this.get(url + "/registry/asset?type=lesson&language=us&visibility=PUBLIC,UNLISTED");
return this.get(url + "/registry/asset?limit=300&type=lesson&language=us&visibility=PUBLIC,UNLISTED");
},
get: id => {
return this.get(url + "/registry/asset/" + id);
Expand Down
1 change: 1 addition & 0 deletions src/js/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const getState = ({ getStore, getActions, setStore }) => {
.all()
.then(_data => {
let data = _data.data || _data;
data = data.results || data;
if (!Array.isArray(data)) data = Object.values(data);
const newStore = {
[mapEntity[entity]]: data
Expand Down

1 comment on commit 3b7bcdb

@vercel
Copy link

@vercel vercel bot commented on 3b7bcdb Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.