bugfix - better routing
This commit is contained in:
parent
0ba99e14eb
commit
2157edd2f0
Binary file not shown.
|
@ -1,3 +1,5 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import Icon from "@/components/Icons/Icon";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
@ -5,9 +7,11 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
|||
import { signInValidationSchema } from "@/utils/form";
|
||||
import { login } from "@/app/actions";
|
||||
import { toast } from "react-toastify";
|
||||
import pb from "@/lib/pocketbase";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
function ModalSignIn() {
|
||||
const router = useRouter();
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
|
@ -25,6 +29,7 @@ function ModalSignIn() {
|
|||
) {
|
||||
reset();
|
||||
document.getElementById("sign-in-modal")?.click();
|
||||
router.push("/account");
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
@ -96,14 +101,31 @@ function ModalSignIn() {
|
|||
</div>
|
||||
|
||||
<div className="flex flex-row w-full justify-between">
|
||||
<button
|
||||
disabled={isSubmitting}
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Sign In
|
||||
{isSubmitting && <div className="loading"></div>}
|
||||
</button>
|
||||
<div className="flex flex-row gap-x-4">
|
||||
<button
|
||||
disabled={isSubmitting}
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Sign In
|
||||
{isSubmitting && <div className="loading"></div>}
|
||||
</button>
|
||||
<div className=" text-xs w-28 block">
|
||||
<span className="whitespace-normal">
|
||||
Dont have an account?{" "}
|
||||
</span>
|
||||
|
||||
<span
|
||||
onClick={() => {
|
||||
document.getElementById("sign-in-modal")?.click();
|
||||
document.getElementById("sign-up-modal")?.click();
|
||||
}}
|
||||
className="text-primary hover:text-primary/60 cursor-pointer "
|
||||
>
|
||||
Sign up
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={() =>
|
||||
document.getElementById("password-reset-modal")?.click()
|
||||
|
|
|
@ -79,7 +79,9 @@ function ModalSignUp({
|
|||
setUser(user as User);
|
||||
console.log("price", price);
|
||||
console.log("type", type);
|
||||
price && generateCheckoutPage(JSON.parse(price), type ?? "");
|
||||
price
|
||||
? generateCheckoutPage(JSON.parse(price), type ?? "")
|
||||
: router.push("/account");
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
|
@ -128,10 +130,10 @@ function ModalSignUp({
|
|||
<div className="flex flex-grow flex-col h-[30rem] lg:h-full overflow-y-scroll">
|
||||
<div className="w-[100%] bg-gradient-to-r from-primary to-secondary px-6 mt-3 pb-6 rounded-lg text-primary-content">
|
||||
<h3 className="pb-1 text-3xl font-bold md:text-3xl pt-6">
|
||||
We Are Growing Fast, and We Want You To Join The Party!
|
||||
Want to 10X Your Content Game?
|
||||
</h3>
|
||||
<p className="text-sm md:text-base">
|
||||
Excited to see what we've got! Signup and get started!
|
||||
Signup and get started using YoutubeTo.Social!
|
||||
</p>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="w-full pl-1">
|
||||
|
@ -244,14 +246,31 @@ function ModalSignUp({
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
disabled={isSubmitting}
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Sign Up
|
||||
{isSubmitting && <div className="loading"></div>}
|
||||
</button>
|
||||
<div className="flex flex-row items-center gap-x-4">
|
||||
<button
|
||||
disabled={isSubmitting}
|
||||
type="submit"
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Sign Up
|
||||
{isSubmitting && <div className="loading"></div>}
|
||||
</button>
|
||||
<div className=" text-xs w-28 block">
|
||||
<span className="whitespace-normal">
|
||||
Already have an account?{" "}
|
||||
</span>
|
||||
|
||||
<span
|
||||
onClick={() => {
|
||||
document.getElementById("sign-up-modal")?.click();
|
||||
document.getElementById("sign-in-modal")?.click();
|
||||
}}
|
||||
className="text-primary hover:text-primary/60 cursor-pointer "
|
||||
>
|
||||
Sign in
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</label>
|
||||
|
|
Loading…
Reference in New Issue