diff --git a/src/components/data/ConsolePanel.js b/src/components/data/ConsolePanel.js index db33a8f..2309fdb 100644 --- a/src/components/data/ConsolePanel.js +++ b/src/components/data/ConsolePanel.js @@ -68,7 +68,10 @@ const ConsolePanel = (props) => { {props.conout.actions.map((msg, i) =>
{moment(msg.timestamp).format('L HH:mm:ss.SSS')} - {msg.payload.txt} + {msg.payload.html + ? + : {msg.payload.txt} + } {msg.payload.obj && }
)} diff --git a/src/store/banking/data/actions.js b/src/store/banking/data/actions.js index 2abee4c..787660b 100644 --- a/src/store/banking/data/actions.js +++ b/src/store/banking/data/actions.js @@ -1,4 +1,4 @@ -import {conoutInfo, conoutError, conoutWarn} from '../../conout/actions' +import {conoutInfo, conoutError, conoutHtmlError, conoutWarn} from '../../conout/actions' import {encodeRFC3986URIComponent} from '../../../utils/url' export const START_RETRIEVE_PRODUCT_LIST = 'START_RETRIEVE_PRODUCT_LIST' @@ -31,6 +31,14 @@ export const retrieveProductList = (dataSourceIdx, baseUrl, productListUrl, xV, payload: fetch(request) .then(response => { if (response.ok) { + if (!response.headers['x-v']) { + const msg = `Response for ${productListUrl}: doesn't expose header x-v: possibly caused by incomplete ` + const corsSupport = 'CORS support' + dispatch(conoutHtmlError( + msg + corsSupport, + `${msg}${corsSupport}` + )) + } return response.json() } throw new Error(`Response not OK. Status: ${response.status} (${response.statusText})`) diff --git a/src/store/conout/actions.js b/src/store/conout/actions.js index 421921f..1bac902 100644 --- a/src/store/conout/actions.js +++ b/src/store/conout/actions.js @@ -18,6 +18,10 @@ export const conoutError = (txt, obj) => { return createLogEntry({lvl: 'error', txt, obj}) } +export const conoutHtmlError = (txt, html, obj) => { + return createLogEntry({lvl: 'error', txt, html, obj}) +} + function createLogEntry(payload) { return { type: CONSOLE_OUT, diff --git a/src/store/discovery/actions.js b/src/store/discovery/actions.js index b2c90d3..545d424 100644 --- a/src/store/discovery/actions.js +++ b/src/store/discovery/actions.js @@ -1,4 +1,4 @@ -import {conoutInfo, conoutError} from '../conout/actions' +import {conoutInfo, conoutHtmlError, conoutError} from '../conout/actions' export const RETRIEVE_STATUS = 'RETRIEVE_STATUS' export const RETRIEVE_OUTAGES = 'RETRIEVE_OUTAGES' @@ -48,6 +48,14 @@ export const retrieveOutages = (dataSourceIdx, url, xV, xMinV) => dispatch => { payload: fetch(request) .then(response => { if (response.ok) { + if (!response.headers['x-v']) { + const msg = `Response for ${fullUrl}: doesn't expose header x-v: possibly caused by incomplete ` + const corsSupport = 'CORS support' + dispatch(conoutHtmlError( + msg + corsSupport, + `${msg}${corsSupport}` + )) + } return response.json() } throw new Error(`Response not OK. Status: ${response.status} (${response.statusText})`) diff --git a/src/store/energy/data/actions.js b/src/store/energy/data/actions.js index e3bd9b7..f158c0a 100644 --- a/src/store/energy/data/actions.js +++ b/src/store/energy/data/actions.js @@ -1,4 +1,4 @@ -import {conoutInfo, conoutError} from '../../conout/actions' +import {conoutInfo, conoutHtmlError, conoutError} from '../../conout/actions' import {encodeRFC3986URIComponent} from '../../../utils/url' export const START_RETRIEVE_PLAN_LIST = 'START_RETRIEVE_PLAN_LIST' @@ -30,6 +30,14 @@ export const retrievePlanList = (dataSourceIdx, baseUrl, planListUrl, xV, xMinV, payload: fetch(request) .then(response => { if (response.ok) { + if (!response.headers['x-v']) { + const msg = `Response for ${planListUrl}: doesn't expose header x-v: possibly caused by incomplete ` + const corsSupport = 'CORS support' + dispatch(conoutHtmlError( + msg + corsSupport, + `${msg}${corsSupport}` + )) + } return response.json() } throw new Error(`Response not OK. Status: ${response.status} (${response.statusText})`)