Skip to content

Commit

Permalink
update onFormSubmit function
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Paul-Larkin committed Feb 26, 2024
1 parent 7928b10 commit 6b62d4a
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions app/(app)/alpha/additional-details/_client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,19 @@ function SlideOne({ details }: { details: UserDetails }) {

const onFormSubmit = async (data: TypeSlideOneSchema) => {
try {
// TODO add server action logic
// await handleFormSlideOneSubmit(data);
toast.success("Saved");
router.push(`?slide=${2}`, { scroll: false });
// const isSuccess = await handleFormSlideOneSubmit(data); TODO add server action
const isSuccess = true;
if (isSuccess) {
toast.success("Saved");
router.push(`?slide=${2}`, { scroll: false });
} else {
toast.error("Error, saving was unsuccessful.");
}
} catch (error) {
toast.error("An unexpected error occurred.");
}
};

// const onFormSubmit = async (data: TypeSlideOneSchema) => {
// try {
// const isSuccess = await handleFormSlideOneSubmit(data);
// if (isSuccess) {
// toast.success("Saved");
// router.push(`?slide=${2}`, { scroll: false });
// } else {
// toast.error("Error, saving was unsuccessful.");
// }
// } catch (error) {
// toast.error("An unexpected error occurred.");
// }
// };

return (
<form onSubmit={handleSubmit(onFormSubmit)}>
<div className="flex min-h-full flex-1 flex-col justify-center px-6 py-12 lg:px-8">
Expand Down

0 comments on commit 6b62d4a

Please sign in to comment.