1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-14 01:16:17 +02:00

Use updated routes from paths cleanup

This commit is contained in:
sveisvei 2017-06-23 08:48:45 +02:00
parent a74c71fe17
commit d82af47a38
7 changed files with 23 additions and 21 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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