bugfix - removed unused imports and added error handling
This commit is contained in:
parent
d00dba19a6
commit
a166bf088a
|
@ -6,6 +6,7 @@ import { useForm } from "react-hook-form";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import { signInValidationSchema } from "@/utils/form";
|
import { signInValidationSchema } from "@/utils/form";
|
||||||
import { login } from "@/app/(auth)/actions";
|
import { login } from "@/app/(auth)/actions";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
function ModalSignIn() {
|
function ModalSignIn() {
|
||||||
const {
|
const {
|
||||||
|
@ -27,7 +28,18 @@ function ModalSignIn() {
|
||||||
document.getElementById("sign-in-modal")?.click();
|
document.getElementById("sign-in-modal")?.click();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("heyaa");
|
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 (
|
return (
|
||||||
|
|
|
@ -74,7 +74,18 @@ function ModalSignUp() {
|
||||||
price && generateCheckoutPage(JSON.parse(price), type ?? "");
|
price && generateCheckoutPage(JSON.parse(price), type ?? "");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("heyaa");
|
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 (
|
return (
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { contactUsValidationSchema } from "@/utils/form";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
const FormLeftDescriptionRightContactUs = () => {
|
const FormLeftDescriptionRightContactUs = () => {
|
||||||
const {
|
const {
|
||||||
|
@ -26,7 +27,18 @@ const FormLeftDescriptionRightContactUs = () => {
|
||||||
await pb.collection("contact").create({ source: "contactus", ...data });
|
await pb.collection("contact").create({ source: "contactus", ...data });
|
||||||
localStorage.setItem("contactus", JSON.stringify(data));
|
localStorage.setItem("contactus", JSON.stringify(data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("heya");
|
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 (
|
return (
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
import pb from "@/lib/pocketbase";
|
import pb from "@/lib/pocketbase";
|
||||||
import { waitinglistValidationSchema } from "@/utils/form";
|
import { waitinglistValidationSchema } from "@/utils/form";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import React, { useEffect } from "react";
|
import React from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
|
|
||||||
import Icon from "@/components/Icon";
|
import Icon from "@/components/Icon";
|
||||||
import colors, { hexToRgb } from "@/utils/colors";
|
|
||||||
import Footer from "@/components/Footer";
|
import Footer from "@/components/Footer";
|
||||||
import { useTheme } from "next-themes";
|
|
||||||
import Background from "@/components/Utilities/Background";
|
import Background from "@/components/Utilities/Background";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
const WaitingListWithImageHero = () => {
|
const WaitingListWithImageHero = () => {
|
||||||
const { theme } = useTheme();
|
|
||||||
const backgroundColor = hexToRgb(colors[theme ?? "light"]["base-100"]);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
@ -31,7 +27,18 @@ const WaitingListWithImageHero = () => {
|
||||||
await pb.collection("contact").create({ source: "waitinglist", ...data });
|
await pb.collection("contact").create({ source: "waitinglist", ...data });
|
||||||
localStorage.setItem("waitinglist", JSON.stringify(data));
|
localStorage.setItem("waitinglist", JSON.stringify(data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("heya");
|
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 (
|
return (
|
||||||
|
@ -62,7 +69,7 @@ const WaitingListWithImageHero = () => {
|
||||||
{...register("firstName")}
|
{...register("firstName")}
|
||||||
type="text"
|
type="text"
|
||||||
id="hs-cover-with-gradient-form-name-1"
|
id="hs-cover-with-gradient-form-name-1"
|
||||||
className=" py-3 ps-11 pe-4 block w-full bg-base-100/[.03] border-white/20 placeholder:text-base-content placeholder:text-base-content rounded-lg text-sm focus:border-white/30 focus:ring-white/30 sm:p-4 sm:ps-11"
|
className=" py-3 ps-11 pe-4 block w-full bg-base-100/[.03] border-white/20 placeholder:text-base-content rounded-lg text-sm focus:border-white/30 focus:ring-white/30 sm:p-4 sm:ps-11"
|
||||||
placeholder="First name"
|
placeholder="First name"
|
||||||
/>
|
/>
|
||||||
<div className="absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-4">
|
<div className="absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-4">
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { newsletterValidationSchema } from "@/utils/form";
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
function Newsletter() {
|
function Newsletter() {
|
||||||
const {
|
const {
|
||||||
|
@ -18,7 +19,18 @@ function Newsletter() {
|
||||||
await pb.collection("contact").create({ source: "newsletter", ...data });
|
await pb.collection("contact").create({ source: "newsletter", ...data });
|
||||||
localStorage.setItem("newsletter", JSON.stringify(data));
|
localStorage.setItem("newsletter", JSON.stringify(data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("heya");
|
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",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue