added Modified
parent
0bd15b48ad
commit
b69df8c707
|
|
@ -1,9 +1,8 @@
|
|||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { Toaster } from "@/components/ui/toaster";
|
||||
import { Toaster } from '@/components/ui/sonner'
|
||||
import Provider from "../utils/ReactQuery/Provider";
|
||||
import { Toaster as SonnerToaster } from "@/components/ui/sonner";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
|
|
@ -22,8 +21,7 @@ export default function RootLayout({
|
|||
<body className={inter.className}>
|
||||
<Provider>
|
||||
{children}
|
||||
<Toaster />
|
||||
<SonnerToaster />
|
||||
<Toaster richColors/>
|
||||
</Provider>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -53,26 +53,23 @@ function LoginForm() {
|
|||
const loginMutation = useMutation({
|
||||
mutationFn: logisterCitizen,
|
||||
onSuccess: (res: any | string) => {
|
||||
router.push("/Verify");
|
||||
localStorage.setItem("VerifyRole", "citizen");
|
||||
localStorage.setItem("verificationToken", res);
|
||||
},
|
||||
onError: (err: any | string) => {
|
||||
if (err.response.status == 428) {
|
||||
router.push("/Verify");
|
||||
}
|
||||
},
|
||||
refetch();
|
||||
toast.error(err.response.data.detail);
|
||||
|
||||
// onSuccess: (res: any | string) => {
|
||||
// router.push("/Verify");
|
||||
// localStorage.setItem("VerifyRole", "citizen");
|
||||
// localStorage.setItem("verificationToken", res);
|
||||
// },
|
||||
// onError: (err: any | string) => {
|
||||
// refetch();
|
||||
// toast(<>{err.response.data.detail}</>, {
|
||||
// className: "!bg-red-500 !text-white",
|
||||
// });
|
||||
// },
|
||||
form.reset({
|
||||
phoneNumber:"",
|
||||
captcha: "",
|
||||
});
|
||||
|
||||
console.log(err);
|
||||
console.log(err.message);
|
||||
console.log(err.detail);
|
||||
},
|
||||
});
|
||||
|
||||
// 1. Define your form.
|
||||
|
|
@ -111,12 +108,12 @@ function LoginForm() {
|
|||
name="phoneNumber"
|
||||
render={({ field }) => (
|
||||
<FormItem className="space-y-2">
|
||||
<FormLabel className="text-black text-lg">تلفن همراه</FormLabel>
|
||||
<FormLabel className="text-black text-lg absolute -mt-4 bg-white mr-4">تلفن همراه</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
placeholder="09"
|
||||
{...field}
|
||||
className="bg-white rounded-3xl focus:bg-white hover:bg-white text-center w-full"
|
||||
className=" w-full"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage className="bg-red text-white text-sm p-1" />
|
||||
|
|
@ -135,7 +132,7 @@ function LoginForm() {
|
|||
<Input
|
||||
placeholder="عبارت امنیتی"
|
||||
{...field}
|
||||
className="bg-white rounded-tr-3xl rounded-br-3xl focus:bg-white hover:bg-white text-center w-full h-10 m-0"
|
||||
className="w-full h-10 m-0"
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage className="bg-red text-white text-sm p-1 mb-4" />
|
||||
|
|
@ -162,7 +159,7 @@ function LoginForm() {
|
|||
alt="icon"
|
||||
src={srcForImage as string}
|
||||
// src={img1}
|
||||
className="h-10 rounded-md shadow-md"
|
||||
className="h-10 rounded-sm shadow-md"
|
||||
width={150}
|
||||
height={20}
|
||||
quality={100}
|
||||
|
|
@ -178,9 +175,23 @@ function LoginForm() {
|
|||
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full p-2 text-black transition bg-yellow hover:bg-yellow rounded-3xl"
|
||||
className="w-full p-2 text-black transition bg-yellow hover:bg-yellow rounded-xl"
|
||||
>
|
||||
ورود
|
||||
{loginMutation.isPending ? (
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<Oval
|
||||
visible={true}
|
||||
height="20"
|
||||
width="20"
|
||||
color="#fff"
|
||||
ariaLabel="oval-loading"
|
||||
wrapperStyle={{}}
|
||||
wrapperClass=""
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
"ورود"
|
||||
)}
|
||||
</Button>
|
||||
</form>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
"use client"
|
||||
import React from 'react'
|
||||
import { YellowSection } from '../SignIn/YellowSection'
|
||||
import { VerifyInput } from './VerifyInput'
|
||||
import { Phone } from 'lucide-react';
|
||||
import useData from "@/store/useData";
|
||||
|
||||
const Verify = () => {
|
||||
const data = useData((state) => state.data);
|
||||
|
||||
|
||||
console.log(data);
|
||||
|
||||
return (
|
||||
<section className="bg-yellow flex h-screen w-full items-stretch justify-center overflow-y-hidden">
|
||||
|
||||
{/* Right Section */}
|
||||
<div className="flex flex-1 items-center justify-center flex-col bg-white rounded-tl-[50px]">
|
||||
{/* <LoginForm /> */}
|
||||
OTP Section
|
||||
<VerifyInput />
|
||||
</div>
|
||||
|
||||
{/* Left Section */}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,28 @@
|
|||
import React from 'react'
|
||||
"use client"
|
||||
import React, { useState ,useEffect } from 'react'
|
||||
import OtpInput from "react-otp-input";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
import useData from "@/store/useData";
|
||||
import { setCookie } from "cookies-next";
|
||||
import { Oval, Triangle } from "react-loader-spinner";
|
||||
import useToken from "@/store/useToken";
|
||||
import { toast } from "sonner";
|
||||
|
||||
|
||||
export const VerifyInput = () => {
|
||||
const [otp, setOtp] = useState("");
|
||||
const space = "\xa0";
|
||||
const router = useRouter();
|
||||
const userData = useData((state) => state.data);
|
||||
const [VerifyRole, setVerifyRole] = useState<any>("");
|
||||
const saveToken = useToken((state) => state.saveToken);
|
||||
|
||||
return (
|
||||
<div>VerifyInput</div>
|
||||
<>
|
||||
<p className="text-2xl color-black text-center font-bold">
|
||||
کد تایید ارسالی به تلفن خود را وارد نمایید.
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
|||
type={type}
|
||||
className={cn(
|
||||
`flex w-full rounded-md border border-input px-3 py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50
|
||||
text-black text-opacity-50 text-xs font-normal bg-slate-200 mb-3
|
||||
text-black text-opacity-50 text-xs font-normal mb-3
|
||||
3xl:h-9 h-10 transition-all
|
||||
hover:bg-slate-300 hover:cursor-pointer focus:cursor-auto
|
||||
focus:outline-4 focus:outline-slate-300 focus:bg-slate-200
|
||||
hover:cursor-pointer focus:cursor-auto
|
||||
focus:outline-4 focus:outline-slate-300
|
||||
bg-white focus:bg-white hover:bg-white text-center
|
||||
|
||||
`,
|
||||
className
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const Toaster = ({ ...props }: ToasterProps) => {
|
|||
return (
|
||||
<Sonner
|
||||
theme={theme as ToasterProps["theme"]}
|
||||
className="toaster group !font-[yekan]"
|
||||
className="toaster group"
|
||||
toastOptions={{
|
||||
classNames: {
|
||||
toast:
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
"react-dom": "^18",
|
||||
"react-hook-form": "^7.51.2",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-otp-input": "^3.1.1",
|
||||
"sonner": "^1.4.41",
|
||||
"tailwind-merge": "^2.2.2",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
|
|
@ -4411,6 +4412,15 @@
|
|||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
|
||||
"integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w=="
|
||||
},
|
||||
"node_modules/react-otp-input": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/react-otp-input/-/react-otp-input-3.1.1.tgz",
|
||||
"integrity": "sha512-bjPavgJ0/Zmf/AYi4onj8FbH93IjeD+e8pWwxIJreDEWsU1ILR5fs8jEJmMGWSBe/yyvPP6X/W6Mk9UkOCkTPw==",
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.6 || ^17.0.0 || ^18.0.0",
|
||||
"react-dom": ">=16.8.6 || ^17.0.0 || ^18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/read-cache": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
"react-dom": "^18",
|
||||
"react-hook-form": "^7.51.2",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-otp-input": "^3.1.1",
|
||||
"sonner": "^1.4.41",
|
||||
"tailwind-merge": "^2.2.2",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
|
|
|
|||
Loading…
Reference in New Issue