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 logs to help debug #251

Merged
merged 1 commit into from
Nov 19, 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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function MyApp({ Component, pageProps }: MyAppProps) {
errorObject
);
}
console.log("MyApp error: ", error);
// We don't want to keep the errors in this object since it's
// going to go into the app's store.
delete router.query.errors;
Expand Down
4 changes: 3 additions & 1 deletion pages/api/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ async function serverSubmit(req: NextApiRequest, res: NextApiResponse) {
let newSubmittedValues = { ...req.body };
// All already submitted values are stored here so we dont run validations
// on those values again.
const existingValues = JSON.parse(req.body.formValues);
console.log("serverSubmit - req.body.formValues: ", req.body.formValues);
const existingValues = !req.body.formValues ? {} : JSON.parse(req.body.formValues);
const currentPage = req.body.page;
// We don't want these values when we do validation.
delete newSubmittedValues.page;
Expand Down Expand Up @@ -101,6 +102,7 @@ async function serverSubmit(req: NextApiRequest, res: NextApiResponse) {
results = await callPatronAPI(existingValues);
page = "congrats";
} catch (error) {
console.log("Error in serverSubmit", error);
errors = error;
}
break;
Expand Down
1 change: 1 addition & 0 deletions src/components/ApiErrors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const ApiErrors = React.forwardRef<HTMLDivElement, ApiErrorsProps>(
}

if (typeof problemDetail !== "string" && !problemDetail.detail) {
console.log("ApiErrors problemDetail: ", problemDetail);
problemDetail.detail = t("apiErrors.defaultError");
}
if (lang !== "en" && typeof problemDetail !== "string") {
Expand Down
Loading