Commit ef7013eb authored by Micha Lutz's avatar Micha Lutz
Browse files

defaultValues

parent 7cf06998
......@@ -18,6 +18,19 @@ import MenuIcon from "@material-ui/icons/Menu";
import { getAccessToken, sendApplication, getStatus } from "./requests";
import { useStyles } from "./styles";
const defaultValues = {
applicant: { givenName: "Werner", familyName: "Mustermann" },
serviceType: { leikaId: "99050012104000", name: "Gewerbeanmeldung" },
applicationData: JSON.stringify(
{
field1: "data1",
field2: { field21: "data21", field22: "data22" },
},
null,
2
),
};
function App() {
// load styles
const classes = useStyles();
......@@ -26,21 +39,9 @@ function App() {
const [status, setStatus] = useState("init");
const [accessToken, setAccessToken] = useState("");
const [destinationId, setDestinationId] = useState("");
const [applicationApplicant, setApplicationApplicant] = useState({ givenName: "Werner", familyName: "Mustermann" });
const [applicationServiceType, setApplicationServiceType] = useState({
leikaId: "99050012104000",
name: "Gewerbeanmeldung",
});
const [applicationData, setApplicationData] = useState(
JSON.stringify(
{
field1: "data1",
field2: { field21: "data21", field22: "data22" },
},
null,
2
)
);
const [applicationApplicant, setApplicationApplicant] = useState(defaultValues.applicant);
const [applicationServiceType, setApplicationServiceType] = useState(defaultValues.serviceType);
const [applicationData, setApplicationData] = useState(defaultValues.applicationData);
const [applicationId, setApplicationId] = useState("");
const [applicationStatus, setApplicationStatus] = useState("");
const [menuAnchorEl, setMenuAnchorEl] = useState(null);
......@@ -92,11 +93,9 @@ function App() {
// handle function to reset the form
const handleNewApplication = () => {
setApplicationApplicant({ givenName: "Werner", familyName: "Mustermann" });
setApplicationServiceType({
leikaId: "99050012104000",
name: "Gewerbeanmeldung",
});
setApplicationApplicant(defaultValues.applicant);
setApplicationServiceType(defaultValues.serviceType);
setApplicationData(defaultValues.applicationData);
setApplicationId("");
setApplicationStatus("");
setStatus("ready");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment