* move window.apiPrefix into Angular service
* avoid routing by accept headers, integrate api service
* Revert "Fixed over-matching of index route."
This reverts commit 62e1225dd3.
* better name for index template file
32 lines
741 B
JavaScript
32 lines
741 B
JavaScript
'use strict';
|
|
|
|
angular.module('insight.blocks')
|
|
.factory('Block',
|
|
function($resource, Api) {
|
|
return $resource(Api.apiPrefix + '/block/:blockHash', {
|
|
blockHash: '@blockHash'
|
|
}, {
|
|
get: {
|
|
method: 'GET',
|
|
interceptor: {
|
|
response: function (res) {
|
|
return res.data;
|
|
},
|
|
responseError: function (res) {
|
|
if (res.status === 404) {
|
|
return res;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
})
|
|
.factory('Blocks',
|
|
function($resource, Api) {
|
|
return $resource(Api.apiPrefix + '/blocks');
|
|
})
|
|
.factory('BlockByHeight',
|
|
function($resource, Api) {
|
|
return $resource(Api.apiPrefix + '/block-index/:blockHeight');
|
|
});
|