File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -25,21 +25,18 @@ export class Qiita extends Gateway {
2525 * @param initialUrl 最初にリクエストするURL
2626 * @param params リクエストのオプション
2727 */
28- protected async * paginationGenerator < T extends any [ ] > ( initialUrl : string , params ?: options . PaginationOptions ) {
29- let next : string | null = initialUrl + ( params ? '?' + querystring . stringify ( params ) : '' ) ;
28+ protected async * paginationGenerator < T extends any [ ] > ( url : string , params ?: options . PaginationOptions ) {
29+ const initialUrl = url + ( params ? '?' + querystring . stringify ( params ) : '' ) ;
30+ let next : string | null = initialUrl ;
3031
31- while ( true ) {
32+ while ( next ) {
3233 const response = await this . get < T > ( next ) ;
33- const result : T | 'reset' = yield response . data ;
34+ const result = yield response . data as T | 'reset' ;
3435
3536 if ( result === 'reset' ) {
3637 next = initialUrl ;
37- }
38-
39- next = getNextUrl ( response . headers ) ;
40-
41- if ( ! next ) {
42- break ;
38+ } else {
39+ next = getNextUrl ( response . headers ) ;
4340 }
4441 }
4542 }
You can’t perform that action at this time.
0 commit comments