1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
This commit is contained in:
ivaosthu 2016-11-10 16:34:39 +01:00
parent 3b53b79fb2
commit 8070e6000e
2 changed files with 4 additions and 3 deletions

View File

@ -31,8 +31,7 @@
"lint": "eslint . --ext=js,jsx",
"test": "echo 'no test'",
"test:ci": "npm run test",
"prepublish": "npm run build",
"postinstall": "npm run build"
"prepublish": "npm run build"
},
"main": "./index.js",
"dependencies": {

View File

@ -1,5 +1,7 @@
const defaultErrorMessage = 'Unexptected exception when talking to unleash-api';
const URI = '/api/metrics/features';
function throwIfNotSuccess (response) {
if (!response.ok) {
if (response.status > 400 && response.status < 404) {
@ -19,7 +21,7 @@ function throwIfNotSuccess (response) {
}
function fetchFeatureMetrics () {
return fetch('/metrics/features')
return fetch(URI)
.then(throwIfNotSuccess)
.then(response => response.json());
}