File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -29,25 +29,23 @@ export default defineLoader({
29
29
async load ( ) : Promise < Data > {
30
30
let page = 1 ;
31
31
let hasNextPage = true ;
32
- const allContributors : Contributor [ ] = [ ] ;
32
+ const contributors : Contributor [ ] = [ ] ;
33
33
34
34
while ( hasNextPage ) {
35
35
const uri = `https://api.github.com/repos/sublimetext-io/docs.sublimetext.io/contributors?per_page=100&page=${ page } ` ;
36
36
37
37
const response = await fetch ( uri ) ;
38
38
39
39
if ( ! response . ok ) {
40
- return {
41
- contributors : [ ] as Contributor [ ]
42
- } ;
40
+ break ;
43
41
}
44
42
45
43
const res : GithubContributor [ ] = await response . json ( ) ;
46
44
47
45
if ( res . length === 0 ) {
48
46
hasNextPage = false ;
49
47
} else {
50
- const contributors : Contributor [ ] = res . map ( ( contributor : GithubContributor ) => ( {
48
+ const contributorsPage : Contributor [ ] = res . map ( contributor => ( {
51
49
avatar : contributor . avatar_url ,
52
50
name : contributor . login ,
53
51
title : 'Contributor' ,
@@ -56,12 +54,13 @@ export default defineLoader({
56
54
]
57
55
} ) ) ;
58
56
59
- allContributors . push ( ...contributors ) ;
57
+ contributors . push ( ...contributorsPage ) ;
60
58
page ++ ;
61
59
}
62
60
}
61
+
63
62
return {
64
- contributors : allContributors
63
+ contributors,
65
64
} ;
66
65
}
67
66
} )
You can’t perform that action at this time.
0 commit comments