[grid-ui] Adding error handler to Apollo, it is not decided yet how to propagate information about handled errors to the components
// specific language governing permissions and limitations
// under the License.
-import {ApolloClient, ApolloProvider, InMemoryCache} from "@apollo/client";
+import {ApolloClient, ApolloLink, ApolloProvider, HttpLink, InMemoryCache} from "@apollo/client";
+import {onError} from "@apollo/client/link/error";
import {HashRouter as Router, Route, Switch} from "react-router-dom";
import React from "react";
import ReactModal from "react-modal";
@@ -28,16 +29,24 @@ import Typography from "@material-ui/core/Typography";
import Sessions from "./screens/Sessions/Sessions";
import Help from "./screens/Help/Help";
+const errorLink = onError(({graphQLErrors, networkError}) => {
+ console.log('GQL ERROR', graphQLErrors, networkError)
+});
+
+const httpLink = new HttpLink({
+ uri: GridConfig.serverUri,
+});
+
export const client = new ApolloClient({
+ link: ApolloLink.from([errorLink, httpLink]),
cache: new InMemoryCache(),
- uri: GridConfig.serverUri,
});
function Copyright() {
// noinspection HtmlUnknownAnchorTarget
return (
<Typography variant="body2" color="textSecondary" align="center">
- <Link href="#help">
+ <Link href="#/help">
Help
</Link>
{' - All rights reserved - '}
@@ -50,7 +59,6 @@ function Copyright() {
);
}
-
const useStyles = makeStyles((theme) => ({
root: {
display: "flex",
