Commit 1ad7983b authored by TJHeeringa's avatar TJHeeringa

Fixed weird behavior after update of profiles

parent cbbbc8ff
......@@ -8,6 +8,7 @@ import React, { useState } from "react";
import { Profile } from "../../Components/InfoForms/Profile";
import Block from "../../Components/PageLayout/Content/Block";
import {useGet} from "restful-react";
const useStyles = makeStyles(theme=>({
......@@ -20,10 +21,16 @@ const useStyles = makeStyles(theme=>({
}
}));
const SharedProfile = ({ preferred_profile }) => {
const SharedProfile = ({ preferred_profile: propProfile }) => {
const theme = useTheme();
const classes = useStyles(theme);
let { data: profile, loading: loadingProfile } = useGet({
path: "/profiles/" + propProfile.slug,
queryParams: {expand: "study"}
});
const [formType, setFormType] = useState("info");
const changeFormType = () => formType === "info" ? setFormType("form") : setFormType("info");
......@@ -50,13 +57,15 @@ const SharedProfile = ({ preferred_profile }) => {
</div>
</div>
<hr className={"box-title-separator"}/>
<Profile
infoOrForm={formType}
profile={preferred_profile}
update={true}
disabled={false}
container={false}
/>
{ loadingProfile ||
<Profile
infoOrForm={formType}
profile={profile}
update={true}
disabled={false}
container={false}
/>
}
</Block>
</Container>
);
......
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