(page = 1, scratchPapers = [])
| 124 | loadScratchPapers() { |
| 125 | const per_page = 100; |
| 126 | const paginateGists = (page = 1, scratchPapers = []) => GitHubApi.listGists({ |
| 127 | per_page, |
| 128 | page, |
| 129 | timestamp: Date.now(), |
| 130 | }).then(gists => { |
| 131 | scratchPapers.push(...gists.filter(gist => 'algorithm-visualizer' in gist.files).map(gist => ({ |
| 132 | key: gist.id, |
| 133 | name: gist.description, |
| 134 | files: Object.keys(gist.files), |
| 135 | }))); |
| 136 | if (gists.length < per_page) { |
| 137 | return scratchPapers; |
| 138 | } else { |
| 139 | return paginateGists(page + 1, scratchPapers); |
| 140 | } |
| 141 | }); |
| 142 | return paginateGists() |
| 143 | .then(scratchPapers => this.props.setScratchPapers(scratchPapers)) |
| 144 | .catch(this.handleError); |
nothing calls this directly
no outgoing calls
no test coverage detected