From 9e281147e294811a7f2d052d5cd0cd831d4877a8 Mon Sep 17 00:00:00 2001 From: Nico Vermaas <vermaas@astron.nl> Date: Fri, 20 Aug 2021 10:09:43 +0200 Subject: [PATCH] blank screen bugfix on login --- src/contexts/QueryContext.js | 16 ++++++++++------ src/routes/Routes.js | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/contexts/QueryContext.js b/src/contexts/QueryContext.js index cd571a0..c9edf45 100644 --- a/src/contexts/QueryContext.js +++ b/src/contexts/QueryContext.js @@ -22,26 +22,27 @@ export function QueryContextProvider({ children }) { // this hook executes fetchConfiguration every time that the values between brackets are changed useEffect(() => { - fetchConfiguration(configName) + if (!fetchConfiguration(configName, {withCredentials: true})) { + fetchConfiguration(configName) + } + }, [api_host, configName]); //}, [api_host, configName, dplevel, collection]); - function fetchConfiguration(configName) { + function fetchConfiguration(configName, header) { let configNameString = ""; if (configName) { configNameString = `?name=${configName}`; } axios - .get(api_host + "query/configuration" + configNameString, {withCredentials: true}) + .get(api_host + "query/configuration" + configNameString, {header}) .then((response) => { //alert(configNameString) let config = response.data["configuration"]; let props = config.query_schema.properties; - console.log("config props: ", props); - console.log("collection value: ", collection); - console.log("dplevel value: ", dplevel); + Object.keys(props).map((key) => { if (key === "collection" && collection) { console.log("has key collection, default value is: ", props[key]["default"]); @@ -58,7 +59,10 @@ export function QueryContextProvider({ children }) { .catch((error) => { let description = ". Configuration not loaded. Is ESAP-API online? " + api_host console.log(error.toString() + description) + //alert(description) }); + + return true } console.log("config: ", { config }); diff --git a/src/routes/Routes.js b/src/routes/Routes.js index 31c4bb6..392ebb4 100644 --- a/src/routes/Routes.js +++ b/src/routes/Routes.js @@ -87,7 +87,7 @@ export default function Routes() { </Switch> - <footer><small>esap-gui version 19 aug 2021 - 8:00</small></footer> + <footer><small>esap-gui version 20 aug 2021 - 10:00</small></footer> </Router> ); } -- GitLab