From d653936d179c81702a649245e1ded50bd0031a9f Mon Sep 17 00:00:00 2001 From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:23:51 -0400 Subject: [PATCH] adding security token usage --- src/components/dialog/observation-chart.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/dialog/observation-chart.js b/src/components/dialog/observation-chart.js index 0abaa23..da7aab3 100644 --- a/src/components/dialog/observation-chart.js +++ b/src/components/dialog/observation-chart.js @@ -4,9 +4,10 @@ import { Typography } from '@mui/material'; import axios from 'axios'; import axiosRetry from 'axios-retry'; import { LineChart, Line, XAxis, YAxis, CartesianGrid, ResponsiveContainer, Tooltip, ReferenceLine } from 'recharts'; - +import { getNamespacedEnvParam } from "@utils/map-utils"; import dayjs from 'dayjs'; + // install day.js for UTC visual formatting const utc = require("dayjs/plugin/utc"); @@ -56,10 +57,16 @@ function getObsChartData(url, setLineButtonView) { // create the function to call for data queryFn: async () => { + // create the authorization header + const requestOptions = { + method: 'GET', + headers: { Authorization: `Bearer ${ getNamespacedEnvParam('REACT_APP_UI_DATA_TOKEN') }`} + }; + // make the call to get the data const ret_val = await axios // make the call to get the data - .get(url) + .get(url, requestOptions) // use the data returned .then (( response ) => { // return the data