Skip to content
Snippets Groups Projects
Commit 87f26607 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

give an alert when ESAP-API could not be reached

parent 0ddc3917
No related branches found
No related tags found
1 merge request!36Dev nico
Pipeline #15141 passed
......@@ -23,7 +23,7 @@ function setProfileState(api_host,
})
.catch((error) => {
alert(error)
// when the token is no longer valid, getting with credentials will fail
// mark the user as being logged out
localStorage.removeItem('esap_logged_in')
......
import React, { createContext, useState, useEffect, useContext } from "react";
import { Alert } from "react-bootstrap";
import axios from "axios";
import useMap from "../hooks/useMap";
import { GlobalContext } from "./GlobalContext";
......@@ -10,7 +11,7 @@ export function QueryContextProvider({ children }) {
const queryMap = useMap();
const [formData, setFormData] = useState();
const [page, setPage] = useState(1);
const [url, setURL] = useState("https://uilennest.net/astrobase/data/191231001/3836665.fits");
const [url, setURL] = useState("");
const [dplevel, setDPLevel] = useState();
const [collection, setCollection] = useState();
const [config, setConfig] = useState();
......@@ -45,7 +46,11 @@ export function QueryContextProvider({ children }) {
return null;
});
setConfig(config);
});
})
.catch((error) => {
let description = ". Configuration not loaded. Is ESAP-API online? " + api_host
alert(error.toString() + description)
});
}, [api_host, configName]);
//}, [api_host, configName, dplevel, collection]);
......
......@@ -72,7 +72,7 @@ export default function Routes() {
</Switch>
<footer><small>esap-gui version 12 jul 2021 - 11:00</small></footer>
<footer><small>esap-gui version 13 jul 2021 - 8:00</small></footer>
</Router>
);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment