Skip to content

Commit

Permalink
fix: loading spinner for certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
azanbinzahid committed Jul 16, 2021
1 parent 8e516bb commit d504be2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/users/enrollments/Certificates.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export default function Certificates({
const oldCourseId = usePrevious(courseId);
const certificateRef = useRef(null);

useEffect(() => {
setCertificateData(undefined);
}, [courseId]);

useEffect(() => {
if ((certificate === undefined && !displayCertErrors) || (courseId !== oldCourseId)) {
getCertificate(username, courseId).then((result) => {
Expand Down

0 comments on commit d504be2

Please sign in to comment.