"use client"; import pb from "@/lib/pocketbase"; import { contactUsValidationSchema } from "@/utils/form"; import { yupResolver } from "@hookform/resolvers/yup"; import React from "react"; import { useForm } from "react-hook-form"; import { toast } from "react-toastify"; const FormLeftDescriptionRightContactUs = () => { const { register, handleSubmit, formState: { errors }, } = useForm({ resolver: yupResolver(contactUsValidationSchema), }); const onSubmit = async (data: { firstName: string; lastName: string; email: string; phoneNumber?: string; note?: string; }) => { try { await pb.collection("contact").create({ source: "contactus", ...data }); localStorage.setItem("contactus", JSON.stringify(data)); } catch (error) { if (error instanceof Error) { toast.error(error.message, { position: "bottom-left", autoClose: 5000, hideProgressBar: false, closeOnClick: true, pauseOnHover: true, draggable: true, progress: undefined, theme: "colored", }); } } }; return ( <> {/* Contact Us */}
{/* Card */}

Fill in the form

{typeof window !== "undefined" && !localStorage.getItem("contactus") ? (
{/* Grid */}
{errors.firstName?.message} 
{errors.lastName?.message} 
{/* End Grid */}
{errors.email?.message} 
{errors.phoneNumber?.message}