feat: add support for pagination on learner page [BD-38] [TNL-9844] (#129)

Adds support for pagination on the learners page, including the learners list, the post, comments and responses lists.
This commit is contained in:
Kshitij Sobti
2022-04-20 16:40:27 +05:30
committed by GitHub
parent 36ff2fad27
commit e8a3e4eaa8
11 changed files with 144 additions and 73 deletions

View File

@@ -202,14 +202,15 @@ export async function uploadFile(blob, filename, courseId, threadKey) {
*
* @param {string} courseId Course ID of the course
* @param {string} username Username of the user
* @param {number} page
* @returns API Response object in the format
* {
* results: [array of posts],
* pagination: {count, num_pages, next, previous}
* }
*/
export async function getUserPosts(courseId, username) {
export async function getUserPosts(courseId, username, { page }) {
const { data } = await getAuthenticatedHttpClient()
.get(threadsApiUrl, { params: { course_id: courseId, author: username } });
.get(threadsApiUrl, { params: { course_id: courseId, author: username, page } });
return data;
}