From c2a1468c5184798efb82ac1a1898a594ad686d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Sat, 15 Sep 2018 13:22:26 +0100 Subject: [PATCH] fix(ui): always pass credentials with fetch() Fixes #24 --- ui/src/Components/NavBar/FilterInput/index.js | 3 ++- ui/src/Components/SilenceModal/LabelNameInput.js | 11 +++++++---- ui/src/Stores/AlertStore.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ui/src/Components/NavBar/FilterInput/index.js b/ui/src/Components/NavBar/FilterInput/index.js index 706d7cf45..f39e5e181 100644 --- a/ui/src/Components/NavBar/FilterInput/index.js +++ b/ui/src/Components/NavBar/FilterInput/index.js @@ -72,7 +72,8 @@ const FilterInput = observer( action(({ value }) => { if (value !== "") { this.inputStore.suggestionsFetch = fetch( - FormatBackendURI(`autocomplete.json?term=${value}`) + FormatBackendURI(`autocomplete.json?term=${value}`), + { credentials: "include" } ) .then( result => result.json(), diff --git a/ui/src/Components/SilenceModal/LabelNameInput.js b/ui/src/Components/SilenceModal/LabelNameInput.js index 57fe99bb9..4fa029579 100644 --- a/ui/src/Components/SilenceModal/LabelNameInput.js +++ b/ui/src/Components/SilenceModal/LabelNameInput.js @@ -18,9 +18,9 @@ const LabelNameInput = observer( populateNameSuggestions = action(() => { const { matcher } = this.props; - this.nameSuggestionsFetch = fetch( - FormatBackendURI(`labelNames.json`) - ) + this.nameSuggestionsFetch = fetch(FormatBackendURI(`labelNames.json`), { + credentials: "include" + }) .then( result => result.json(), err => { @@ -43,7 +43,10 @@ const LabelNameInput = observer( const { matcher } = this.props; this.valueSuggestionsFetch = fetch( - FormatBackendURI(`labelValues.json?name=${matcher.name}`) + FormatBackendURI(`labelValues.json?name=${matcher.name}`), + { + credentials: "include" + } ) .then( result => result.json(), diff --git a/ui/src/Stores/AlertStore.js b/ui/src/Stores/AlertStore.js index b51ee7c6f..2b899632b 100644 --- a/ui/src/Stores/AlertStore.js +++ b/ui/src/Stores/AlertStore.js @@ -199,7 +199,7 @@ class AlertStore { FormatBackendURI("alerts.json?") + FormatAPIFilterQuery(this.filters.values.map(f => f.raw)); - return fetch(alertsURI) + return fetch(alertsURI, { credentials: "include" }) .then(result => result.json()) .then(result => { return this.parseAPIResponse(result);