You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
portainer/app/docker/interceptors/containersInterceptor.js

21 lines
703 B

angular.module('portainer.app')
.factory('ContainersInterceptor', ['$q', 'EndpointProvider', function ($q, EndpointProvider) {
'use strict';
var interceptor = {};
interceptor.responseError = responseErrorInterceptor;
function responseErrorInterceptor(rejection) {
if (rejection.status === 502 || rejection.status === 503 || rejection.status === -1) {
var endpoint = EndpointProvider.currentEndpoint();
if (endpoint !== undefined) {
var data = endpoint.Snapshots[0].SnapshotRaw.Containers;
if (data !== undefined) {
return data;
}
}
}
return $q.reject(rejection);
}
return interceptor;
}]);