backstrokeapp / backstrokeapp/dashboard

Support paging on the `link-list` page.

Open
#4 1 comment 1 reaction 0 assignees View on GitHub
enhancement hacktoberfest help wanted
Dominant language
JavaScript
Stars
6
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Currently, the dashboard only fetches the first page of links to display on the `link-list` page. The goal would be to support an arbitrary number of pages, since any links not on the first page are never displayed on the backstroke dashboard.

Here's an example response of `GET https://api.backstroke.co/v1/links?page=3`, the endpoint that fetches all links:

```json
{
"page": 3,
"data": [
{
"id": 248,
"name": "My fork of nicss",
"enabled": true,
"webhook": "59305a11edee18001c240d58",
"createdAt": "2017-10-07T19:01:21.914Z",
"lastSyncedAt": "2017-10-08T19:07:36.304Z",
"fork": {
"type": "repo",
"owner": "1egoman",
"repo": "nicss",
"isFork": true,
"branches": [
"contributing-doc",
"master",
"npm-publish-on-push"
],
"branch": "master"
},
"upstream": {
"type": "repo",
"owner": "densityco",
"repo": "nicss",
"branches": [
"contributing-doc",
"master",
"npm-publish-on-push"
],
"branch": "master"
}
},
(other links here...)
]
}
```

I see two possible ways of approaching this:
1. The easier of the two, the [COLLECTION_LINKS_FETCH](https://github.com/backstrokeapp/dashboard/blob/master/src/actions/collection/links/fetch.js) action could fetch all pages of links by recursively calling fetch until `response.data`'s length is `0`.
2. Another possibility would be to update the [COLLECTION_LINKS_FETCH](https://github.com/backstrokeapp/dashboard/blob/master/src/actions/collection/links/fetch.js) action to accept a page number as one of its arguments, and only fetch that page of data. Then, some sort of ui component would need to be created to allow the user to page through the data that the server returns.

If you have a different idea not related to 1 or 2 above, I'm open to it! Those are just the two ideas that I thought of. Thanks for contributing to Backstroke!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.