Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sanasnaik committed Oct 13, 2024
1 parent 89d6b62 commit 4ea642e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
13 changes: 7 additions & 6 deletions app/dashboard/components/profileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ export default function ProfileHeader(props: {
</div>

<Card className="w-full max-w-2xl">
<form onSubmit={async (e) => {
e.preventDefault();
setLoading(true);
onWaiverSubmit(e, setLoading);
setLoading(false);
}}>
<form
onSubmit={async (e) => {
setLoading(true);
await onWaiverSubmit(e);
setLoading(false);
}}
>
<CardHeader>
<CardTitle>Registration</CardTitle>
<CardDescription>Check your registration status.</CardDescription>
Expand Down
8 changes: 1 addition & 7 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export default function Dashboard() {
const [submittingTeamForm, setSubmittingTeamForm] = useState<boolean>(false);
const [userProfileSubmitText, setUserProfileSubmitText] = useState<string>("Save");

const [loading, setLoading] = useState(false)
const [displayTeamFormFinalSubmissionWarning, setDisplayTeamFormFinalSubmissionWarning] = useState<boolean>(false);
const [teamSubmissionError, setTeamSubmissionError] = useState<string>("");
const [currentTeam, setCurrentTeam] = useState<number>(0);
Expand Down Expand Up @@ -177,9 +176,8 @@ export default function Dashboard() {
setUserProfileSubmitText("Saved!");
}

const onWaiverSubmit = async (event: React.FormEvent<HTMLFormElement>, setLoading: (isLoading: boolean) => void) => {
const onWaiverSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
setLoading(true);

if (waiverFile) { //works
try {
Expand All @@ -197,7 +195,6 @@ export default function Dashboard() {
console.log("THIS FIELD IS FAIL" + requiredFields[i])
trigger(requiredFields[i] as any, { shouldFocus: true });
alert(`Please scroll down and fill out ${fieldtext[i]} and the entire profile and save before registering`);
setLoading(false);
return;
}
}
Expand All @@ -216,12 +213,10 @@ export default function Dashboard() {
} catch (error) {
console.error("Error uploading waiver:", error);
alert("Error uploading waiver. Please contact HackRU.");
setLoading(false);
}
} else {
console.error("No waiver file selected");//works
alert("Please select a waiver file");
setLoading(false);
}
}
const handleChangingFile = (event: React.ChangeEvent<HTMLInputElement>,
Expand Down Expand Up @@ -283,7 +278,6 @@ export default function Dashboard() {

const haswaiver = await GetWaiverInfo();
setWaiverState(haswaiver.response.hasUploaded);
// setLoading(false);

} catch (error) {
console.log(error);
Expand Down

0 comments on commit 4ea642e

Please sign in to comment.