@@ -9,6 +9,7 @@ const state = {
99 isInstallerLocked : false ,
1010 installerCurrentJob : null ,
1111 requirements : [ ] ,
12+ repositories : [ ] ,
1213 jobs : [ ] ,
1314 protectedRequirements : [
1415 'php' ,
@@ -40,9 +41,12 @@ const actions = {
4041 // Need this pre-lock to work with `sync` queue
4142 context . commit ( 'lockInstaller' , payload ) ;
4243
43- const response = await Axios . post ( this . getters . getUrl ( '/api/jobs' ) , payload ) ;
44-
45- context . commit ( 'lockInstaller' , response . data ) ;
44+ try {
45+ const response = await Axios . post ( this . getters . getUrl ( '/api/jobs' ) , payload ) ;
46+ context . commit ( 'lockInstaller' , response . data ) ;
47+ } catch ( exception ) {
48+ context . commit ( 'unlockInstaller' ) ;
49+ }
4650
4751 this . dispatch ( 'collectRequirements' ) ;
4852 this . dispatch ( 'collectJobs' ) ;
@@ -52,6 +56,20 @@ const actions = {
5256 await Axios . delete ( this . getters . getUrl ( `/api/jobs/${ payload . id } ` ) ) ;
5357 } ,
5458
59+ async collectRepositories ( ) {
60+ const url = this . getters . getUrl ( '/api/repositories' ) ;
61+
62+ try {
63+ const response = await Axios . get ( url ) ;
64+
65+ if ( response . status === 200 ) {
66+ this . state . repositories = response . data ;
67+ }
68+ } catch ( exception ) {
69+ console . warn ( `Cannot fetch ${ url } ` ) ;
70+ }
71+ } ,
72+
5573 async collectJobs ( ) {
5674 const url = this . getters . getUrl ( '/api/jobs' ) ;
5775
@@ -103,6 +121,10 @@ const getters = {
103121 return window . location . origin + '/' + window . Paket . baseUri + uri ;
104122 } ,
105123
124+ getRepositories : ( state , getters ) => ( ) => {
125+ return state . repositories ;
126+ } ,
127+
106128 getJobs : ( state , getters ) => ( ) => {
107129 return state . jobs ;
108130 } ,
0 commit comments