diff --git a/package.json b/package.json
index 922f892..6f1f2e9 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"eject": "react-scripts eject"
},
"dependencies": {
+ "js-cookie": "^2.2.1",
"@jsonforms/core": "^2.4.0",
"@jsonforms/material-renderers": "^2.4.0",
"@jsonforms/react": "^2.4.0",
diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx
index c5b1167..41541be 100644
--- a/src/components/layout/Header.tsx
+++ b/src/components/layout/Header.tsx
@@ -13,6 +13,7 @@ import { Link } from "react-router-dom";
import { store } from "../../store/store";
import { withCookies } from "react-cookie";
import { LinearProgress } from "@material-ui/core";
+import { httpClient } from "../../helper/api-client";
const useStyles = makeStyles((theme: Theme) =>
createStyles({
@@ -26,11 +27,12 @@ const useStyles = makeStyles((theme: Theme) =>
flexGrow: 1,
},
progressBar: {
- width: '100%',
- '& > * + *': {
+ width: "100%",
+ "& > * + *": {
marginTop: theme.spacing(1),
- }
- }})
+ },
+ },
+ })
);
function MenuAppBar(props: any) {
@@ -57,10 +59,8 @@ function MenuAppBar(props: any) {
dispatch({ type: "setAuthentication", value: true });
};
const handleLogout = async () => {
- fetch("/api/logout", {
+ httpClient("/api/logout", {
method: "POST",
- credentials: "include",
- headers: { "X-XSRF-TOKEN": csrfToken },
}).then((response) => {
if (response.ok) {
dispatch({ type: "setAuthentication", value: false });
@@ -161,7 +161,13 @@ function MenuAppBar(props: any) {
)}
- {props.loading ?
: <>>}
+ {props.loading ? (
+
+
+
+ ) : (
+ <>>
+ )}
);
}
diff --git a/src/components/manifest/Form.tsx b/src/components/manifest/Form.tsx
index 3416f3b..50d4df3 100644
--- a/src/components/manifest/Form.tsx
+++ b/src/components/manifest/Form.tsx
@@ -5,88 +5,66 @@ import { Grid } from "@material-ui/core";
import { Alert } from "@material-ui/lab";
import { withCookies } from "react-cookie";
import SchemaForm from "./SchemaForm";
-import { toast } from 'react-toastify';
+import { toast } from "react-toastify";
import ConfirmationButton from "../common/ConfirmationButton";
import _ from "lodash";
-
+import { httpClient } from "../../helper/api-client";
const formatDisplayData = (standaloneData) => {
return JSON.stringify(standaloneData, null, 2);
};
-const withError = (error: Object, component: React.ReactElement): React.ReactElement => {
+const withError = (
+ error: Object,
+ component: React.ReactElement
+): React.ReactElement => {
if (_.isEmpty(error)) {
- return component
+ return component;
} else {
- return {formatDisplayData(error)}
+ return {formatDisplayData(error)};
}
-}
+};
const Form = (props: any) => {
const { cookies } = props;
const standaloneData = useRef