1
- import { api , proxy } from "../../utils/request" ;
1
+ import { api , proxy , local } from "../../utils/request" ;
2
2
import lodash from "lodash" ;
3
3
4
4
function getLastCommit ( repo ) {
5
5
return api . get ( `/repos/ovh-ux/${ repo } /commits` )
6
- . catch ( ( ) => proxy . get ( `/repos/ovh-ux/ ${ repo } /commits ` ) )
6
+ . catch ( ( ) => local . get ( `${ repo } _last_commits.json ` ) )
7
7
. then ( ( response ) => {
8
8
const last = response . data [ 0 ] . sha ;
9
9
return last ;
@@ -12,7 +12,7 @@ function getLastCommit (repo) {
12
12
13
13
function compareCommits ( repo , first , last ) {
14
14
return api . get ( `/repos/ovh-ux/${ repo } /compare/${ first } ...${ last } ` )
15
- . catch ( ( ) => proxy . get ( `/repos/ovh-ux/ ${ repo } /compare/ ${ first } ... ${ last } ` ) )
15
+ . catch ( ( ) => local . get ( `${ repo } _compare.json ` ) )
16
16
. then ( ( response ) => {
17
17
const total = response . data . total_commits ;
18
18
return total ;
@@ -21,7 +21,7 @@ function compareCommits (repo, first, last) {
21
21
22
22
function getCommits ( repo ) {
23
23
return getLastCommit ( repo ) . then ( ( lastcommit ) => {
24
- const first = { "ovh-manager-web" : "6a63e7c0199620f8e62d73a378cde770bb51f56f" , "ovh-manager-cloud" : "44256bffb7ab124e9537c470cbfa42b4fae7432f" , "ovh-manager-telecom" : "7ddd35c7ccde0f55dd217852949c5ef83e9c85a9" , "ovh-manager-dedicated" : "c9c25615fb3e2a8f975e5906268dc259675be799" } ;
24
+ const first = { "ovh-manager-web" : "6a63e7c0199620f8e62d73a378cde770bb51f56f" , "ovh-manager-cloud" : "44256bffb7ab124e9537c470cbfa42b4fae7432f" , "ovh-manager-telecom" : "7ddd35c7ccde0f55dd217852949c5ef83e9c85a9" , "ovh-manager-dedicated" : "c9c25615fb3e2a8f975e5906268dc259675be799" } ;
25
25
return compareCommits ( repo , first [ repo ] , lastcommit ) . then ( ( response ) => {
26
26
return response + 1 ;
27
27
} ) ;
@@ -30,7 +30,7 @@ function getCommits (repo) {
30
30
31
31
function getContributors ( repo ) {
32
32
return api . get ( `/repos/ovh-ux/${ repo } /contributors` )
33
- . catch ( ( ) => proxy . get ( `/repos/ovh-ux/ ${ repo } /contributors ` ) )
33
+ . catch ( ( ) => local . get ( `${ repo } _contributors.json ` ) )
34
34
. then ( ( response ) => {
35
35
const data = response . data ;
36
36
const contributors = [ ] ;
@@ -45,7 +45,7 @@ function getContributors (repo) {
45
45
46
46
function getTopics ( repo ) {
47
47
return api . get ( `/repos/ovh-ux/${ repo } /topics` )
48
- . catch ( ( ) => proxy . get ( `/repos/ovh-ux/ ${ repo } /topics ` ) )
48
+ . catch ( ( ) => local . get ( `${ repo } _topics.json ` ) )
49
49
. then ( ( response ) => {
50
50
const data = response . data . names ;
51
51
const topics = [ ] ;
@@ -60,7 +60,7 @@ function getTopics (repo) {
60
60
export default {
61
61
nbrRepos ( { commit } ) {
62
62
return api . get ( "/users/ovh-ux" )
63
- . catch ( ( ) => proxy . get ( "/users/ ovh-ux" ) )
63
+ . catch ( ( ) => local . get ( "ovh-ux.json " ) )
64
64
. then ( ( response ) => {
65
65
const nbr_repos = response . data . public_repos ;
66
66
@@ -69,15 +69,15 @@ export default {
69
69
} ,
70
70
lastPushed ( { commit } ) {
71
71
return api . get ( "/users/ovh-ux/repos?sort=pushed&direction=desc" )
72
- . catch ( ( ) => proxy . get ( "/users/ovh-ux/repos?sort=pushed&direction=desc " ) )
72
+ . catch ( ( ) => local . get ( "reposDesc.json " ) )
73
73
. then ( ( response ) => {
74
74
const last = response . data [ 0 ] ;
75
75
commit ( "LAST_PUSHED" , last ) ;
76
76
} ) ;
77
77
} ,
78
78
aboutTechno ( { commit } ) {
79
79
return api . get ( "/users/ovh-ux/repos?per_page=500" )
80
- . catch ( ( ) => proxy . get ( "/users/ovh-ux/repos?per_page=500 " ) )
80
+ . catch ( ( ) => local . get ( "reposAll.json " ) )
81
81
. then ( ( response ) => {
82
82
const data = response . data ;
83
83
const language_obj = { } ;
@@ -104,7 +104,7 @@ export default {
104
104
} ,
105
105
manager ( { commit } , repo ) {
106
106
api . get ( `/repos/ovh-ux/${ repo } ` )
107
- . catch ( ( ) => proxy . get ( `/repos/ovh-ux/ ${ repo } ` ) )
107
+ . catch ( ( ) => local . get ( `${ repo } .json ` ) )
108
108
. then ( ( data ) => {
109
109
getCommits ( repo ) . then ( ( commits ) => {
110
110
getContributors ( repo ) . then ( ( contributors ) => {
@@ -125,7 +125,6 @@ export default {
125
125
} ,
126
126
otherProjects ( { commit } ) {
127
127
return api . get ( "/users/ovh-ux/repos?sort=pushed&direction=desc" )
128
- . catch ( ( ) => proxy . get ( "/users/ovh-ux/repos?sort=pushed&direction=desc" ) )
129
128
. then ( ( response ) => {
130
129
const data = response . data ;
131
130
commit ( "OTHER_PROJECTS" , data ) ;
0 commit comments