Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding more error checking, and wording changes #203

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,18 @@ export default function Dashboard() {
else{
console.log("THIS FIELD IS FAIL" + requiredFields[i])
trigger(requiredFields[i] as any, { shouldFocus: true });
alert(`Please scroll down and fill out ${fieldtext[i]} the entire profile before registering`);
alert(`Please scroll down and fill out ${fieldtext[i]} and the entire profile and save before registering`);
return;
}
}
}

await UploadWaiver(data);
if (Object.keys(errors).length === 0) {
RegisterSelf();
setUserData({ ...userData, registration_status: "registered" })
const resp = await RegisterSelf();
if (resp == "User updated successfully"){
setUserData({ ...userData, registration_status: "registered" })
}
}

//window.location.reload();
Expand Down
7 changes: 5 additions & 2 deletions app/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,15 @@ export async function SetUser(data: any, user_email_to_update: string) {
.then(async (res) => {
let resJSON = await res.json();
if (resJSON.statusCode !== 200) {
if (resJSON.body) {
resp.error = resJSON.body;
if (resJSON?.error) {
resp.error = resJSON.error;
} else {
resp.error = 'Unexpected Error';
}
}
else{
resp.response = resJSON.message;
}
})
.catch((error) => {
resp.error = error + '; An error occurred retrieving data';
Expand Down
4 changes: 1 addition & 3 deletions app/lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ export async function RegisterSelf() {
return resp.error;
}

return {
error: 'Something went wrong',
};
return 'Something went wrong';
}

export async function ConfirmComingOrNot(isComing: boolean): Promise<{
Expand Down
Loading