Skip to content

Commit

Permalink
Fixed some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromehardaway committed Feb 9, 2024
1 parent 7f2942f commit 3687317
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/data/innerpages/contact-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
{
"section": "contact-form",
"section_title": {
"title": "Contact us with this from and we will get back to you as soon as possible"
"title": "Contact us with this form and we will get back to you as soon as possible"
}
}
]
Expand Down
16 changes: 7 additions & 9 deletions src/pages/api/api-helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
type EventBody = {
[key: string]: any;
[key: string]: unknown;
};

export function checkParams(eventBody: EventBody, params: string[]): boolean {
return params.some(
(k) => typeof eventBody[k] === "undefined" || !eventBody[k]
);
return params.some((k) => {
const value = eventBody[k];
return typeof value === "undefined" || value === null || value === "";
// Further specific checks can be added based on the expected types of values.
});
}

export const checkLength = (message: string): boolean => {
const { length } = message.trim().split(" ");
if (length === 1) {
return true;
}
return false;
return message.trim().split(/\s+/).length === 1;
};

export const contactErrors = {
Expand Down

0 comments on commit 3687317

Please sign in to comment.