diff --git a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js index 2c75416228785006a851923f0e2bc4adc72ae1c6..4fcd0bec6d78a71ffe77d2013c661a5aa0092a20 100644 --- a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js +++ b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js @@ -274,17 +274,18 @@ export default function EditCreateUserProfile(props) { }; React.useEffect(() => { - setLoading(true); - const timer = setInterval(() => { - setProgress((oldProgress) => { - if (oldProgress === 100) { - return 0; - } - const diff = Math.random() * 10; - return Math.min(oldProgress + diff, 100); - }); - }, 500); + if (!createUser) { + setLoading(true); + const timer = setInterval(() => { + setProgress((oldProgress) => { + if (oldProgress === 100) { + return 0; + } + const diff = Math.random() * 10; + return Math.min(oldProgress + diff, 100); + }); + }, 500); setUserName(props.username); axios( configApiCall( @@ -320,10 +321,11 @@ export default function EditCreateUserProfile(props) { .catch((error) => { console.log("Error fetching user : " + props.username + " " + error); }); + + return () => { + clearInterval(timer); + }; } - return () => { - clearInterval(timer); - }; }, []); const resizeFile = (file, outputFormat) =>