Skip to content

Commit 726e3d4

Browse files
feat: show loader when downloading timetable
1 parent 8733146 commit 726e3d4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

frontend/src/components/Timetable.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const Timetable: React.FC<props> = ({ file }) => {
1616
e: React.MouseEvent<HTMLButtonElement, MouseEvent>
1717
) => {
1818
e.preventDefault();
19+
setLoading(true);
1920
const formData = new URLSearchParams();
2021
formData.append("roll_number", user.rollNo);
2122

@@ -60,9 +61,12 @@ const Timetable: React.FC<props> = ({ file }) => {
6061
document.body.appendChild(a);
6162
a.click();
6263
a.remove();
64+
65+
setLoading(false);
6366
} catch (error) {
6467
toast.error(`Error fetching timetable!`);
6568
console.error("Error fetching timetable", error);
69+
setLoading(false);
6670
} finally {
6771
setLoading(false);
6872
}

0 commit comments

Comments
 (0)