From d82af47a381298b0a48730d7f0f8d3cd826c4613 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Fri, 23 Jun 2017 08:48:45 +0200 Subject: [PATCH] Use updated routes from paths cleanup --- frontend/src/data/applications-api.js | 11 +++++++---- frontend/src/data/archive-api.js | 4 ++-- frontend/src/data/client-instance-api.js | 4 ++-- frontend/src/data/feature-api.js | 7 +++---- frontend/src/data/feature-metrics-api.js | 8 ++++---- frontend/src/data/history-api.js | 6 +++--- frontend/src/data/strategy-api.js | 4 ++-- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/frontend/src/data/applications-api.js b/frontend/src/data/applications-api.js index 5823d8d3d1..7769ca68aa 100644 --- a/frontend/src/data/applications-api.js +++ b/frontend/src/data/applications-api.js @@ -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()); } diff --git a/frontend/src/data/archive-api.js b/frontend/src/data/archive-api.js index ed3fa96525..bc4979f3fe 100644 --- a/frontend/src/data/archive-api.js +++ b/frontend/src/data/archive-api.js @@ -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()); } diff --git a/frontend/src/data/client-instance-api.js b/frontend/src/data/client-instance-api.js index 109d511196..c0df8eb521 100644 --- a/frontend/src/data/client-instance-api.js +++ b/frontend/src/data/client-instance-api.js @@ -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()); } diff --git a/frontend/src/data/feature-api.js b/frontend/src/data/feature-api.js index 8be11f6d28..69b7133199 100644 --- a/frontend/src/data/feature-api.js +++ b/frontend/src/data/feature-api.js @@ -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', diff --git a/frontend/src/data/feature-metrics-api.js b/frontend/src/data/feature-metrics-api.js index 2050b95deb..68e9c9c214 100644 --- a/frontend/src/data/feature-metrics-api.js +++ b/frontend/src/data/feature-metrics-api.js @@ -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()); } diff --git a/frontend/src/data/history-api.js b/frontend/src/data/history-api.js index 2c410b4aa6..6a3af3bb4c 100644 --- a/frontend/src/data/history-api.js +++ b/frontend/src/data/history-api.js @@ -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()); } diff --git a/frontend/src/data/strategy-api.js b/frontend/src/data/strategy-api.js index 983290d564..63530cfb9e 100644 --- a/frontend/src/data/strategy-api.js +++ b/frontend/src/data/strategy-api.js @@ -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()); }