1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Merge pull request #80 from Unleash/refactor-api-root

Use updated routes from paths cleanup
This commit is contained in:
Sveinung Røsaker 2017-06-28 12:38:55 +02:00 committed by GitHub
commit 48ced5374a
8 changed files with 24 additions and 21 deletions

View File

@ -8,6 +8,7 @@ The latest version of this document is always available in
[releases][releases-url].
## [Unreleased]
- updated paths to use new admin api paths
## [2.2.0] - 2017-01-20
- clean filter/sorting and fabbutton #61

View File

@ -1,21 +1,24 @@
import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/client/applications';
const URI = 'api/admin/metrics/applications';
function fetchAll () {
return fetch(URI, { headers })
return fetch(URI, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
function fetchApplication (appName) {
return fetch(`${URI}/${appName}`, { headers })
return fetch(`${URI}/${appName}`, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
function fetchApplicationsWithStrategyName (strategyName) {
return fetch(`${URI}?strategyName=${strategyName}`, { headers })
return fetch(`${URI}?strategyName=${strategyName}`, {
headers,
credentials: 'include',
})
.then(throwIfNotSuccess)
.then(response => response.json());
}

View File

@ -1,9 +1,9 @@
import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/archive';
const URI = 'api/admin/archive';
function fetchAll () {
return fetch(`${URI}/features`)
return fetch(`${URI}/features`, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}

View File

@ -1,9 +1,9 @@
import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/client/instances';
const URI = 'api/admin/metrics/instances';
function fetchAll () {
return fetch(URI, { headers })
return fetch(URI, { headers, credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}

View File

@ -1,7 +1,6 @@
import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/features';
const URI_VALIDATE = 'api/features-validate';
const URI = 'api/admin/features';
function validateToggle (featureToggle) {
return new Promise((resolve, reject) => {
@ -14,7 +13,7 @@ function validateToggle (featureToggle) {
}
function fetchAll () {
return fetch(URI)
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
@ -31,7 +30,7 @@ function create (featureToggle) {
}
function validate (featureToggle) {
return fetch(URI_VALIDATE, {
return fetch(`${URI}/validate`, {
method: 'POST',
headers,
credentials: 'include',

View File

@ -1,17 +1,17 @@
const { throwIfNotSuccess } = require('./helper');
const URI = 'api/client/metrics/feature-toggles';
const URI = 'api/admin/metrics/feature-toggles';
function fetchFeatureMetrics () {
return fetch(URI)
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
const seenURI = 'api/client/seen-apps';
const seenURI = 'api/admin/metrics/seen-apps';
function fetchSeenApps () {
return fetch(seenURI)
return fetch(seenURI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}

View File

@ -1,15 +1,15 @@
import { throwIfNotSuccess } from './helper';
const URI = 'api/events';
const URI = 'api/admin/events';
function fetchAll () {
return fetch(URI)
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}
function fetchHistoryForToggle (toggleName) {
return fetch(`${URI}/${toggleName}`)
return fetch(`${URI}/${toggleName}`, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}

View File

@ -1,9 +1,9 @@
import { throwIfNotSuccess, headers } from './helper';
const URI = 'api/strategies';
const URI = 'api/admin/strategies';
function fetchAll () {
return fetch(URI)
return fetch(URI, { credentials: 'include' })
.then(throwIfNotSuccess)
.then(response => response.json());
}