Skip to content

Commit

Permalink
Fix frontend Vuex store
Browse files Browse the repository at this point in the history
- Handle 204 status codes in fetch Promise
  • Loading branch information
schrieveslaach committed Feb 14, 2019
1 parent bfb315e commit 35654d8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ export default new Vuex.Store( {
].map( container => {
let swaggerUrl = undefined;
let logsUrl = undefined;
if ( state.status.swaggerUiAvailable && container.version && container.version.api ) {
swaggerUrl = container.url.replace( `/${container.vhost}/`, '/swagger-ui/' )
+ `?url=${container.version.api.url}`;
}
// if ( state.status.swaggerUiAvailable && container.version && container.version.api ) {
// swaggerUrl = container.url.replace( `/${container.vhost}/`, '/swagger-ui/' )
// + `?url=${container.version.api.url}`;
// }

return Object.assign( {}, container, { swaggerUrl, logsUrl } );
} );
containers.sort( byVhost );
Expand Down Expand Up @@ -118,13 +119,18 @@ export default new Vuex.Store( {
fetchData( context ) {
Promise.all([
fetch( '/api/apps' )
.then( response => response.json() ),
.then( response => {
if (response.ok && response.status === 200) {
return response.json();
}
return Promise.resolve(() => {});
} ),
fetch( '/api/apps/tickets' )
.then( response => {
if (response.ok) {
return response.json()
if (response.ok && response.status === 200) {
return response.json();
}
return {};
return Promise.resolve(() => {});
} )
]).then((values) => {
context.commit( "storeTickets", values[1] );
Expand Down

0 comments on commit 35654d8

Please sign in to comment.