From 6b62d4a8199bf779d2f14bfea9f3c93af232e6c9 Mon Sep 17 00:00:00 2001 From: John Paul Larkin Date: Mon, 26 Feb 2024 23:24:00 +0000 Subject: [PATCH] update onFormSubmit function --- .../alpha/additional-details/_client.tsx | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/app/(app)/alpha/additional-details/_client.tsx b/app/(app)/alpha/additional-details/_client.tsx index 8eb6abb3..74c25f78 100644 --- a/app/(app)/alpha/additional-details/_client.tsx +++ b/app/(app)/alpha/additional-details/_client.tsx @@ -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 (