added a interceptor in ther services to handle the server request error
This commit is contained in:
parent
ce1fde9aa7
commit
c3a6c0387c
|
@ -3,6 +3,20 @@
|
||||||
angular.module('mystery.address').factory('Address', ['$resource', function($resource) {
|
angular.module('mystery.address').factory('Address', ['$resource', function($resource) {
|
||||||
return $resource('/api/addr/:addrStr', {
|
return $resource('/api/addr/:addrStr', {
|
||||||
addrStr: '@addStr'
|
addrStr: '@addStr'
|
||||||
|
}, {
|
||||||
|
get: {
|
||||||
|
method: 'GET',
|
||||||
|
interceptor: {
|
||||||
|
response: function (res) {
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
responseError: function (res) {
|
||||||
|
if (res.status === 404) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,20 @@
|
||||||
angular.module('mystery.blocks').factory('Block', ['$resource', function($resource) {
|
angular.module('mystery.blocks').factory('Block', ['$resource', function($resource) {
|
||||||
return $resource('/api/block/:blockHash', {
|
return $resource('/api/block/:blockHash', {
|
||||||
blockHash: '@blockHash'
|
blockHash: '@blockHash'
|
||||||
|
}, {
|
||||||
|
get: {
|
||||||
|
method: 'GET',
|
||||||
|
interceptor: {
|
||||||
|
response: function (res) {
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
responseError: function (res) {
|
||||||
|
if (res.status === 404) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,20 @@
|
||||||
angular.module('mystery.transactions').factory('Transaction', ['$resource', function($resource) {
|
angular.module('mystery.transactions').factory('Transaction', ['$resource', function($resource) {
|
||||||
return $resource('/api/tx/:txId', {
|
return $resource('/api/tx/:txId', {
|
||||||
txId: '@txId'
|
txId: '@txId'
|
||||||
|
}, {
|
||||||
|
get: {
|
||||||
|
method: 'GET',
|
||||||
|
interceptor: {
|
||||||
|
response: function (res) {
|
||||||
|
return res.data;
|
||||||
|
},
|
||||||
|
responseError: function (res) {
|
||||||
|
if (res.status === 404) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue