PK!A7��nimport { InputGroup, FieldWrapper, Label, } from "../Components/Styles/InputStyles"; import Loading from "../Components/Loading"; import { toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import Config from "../Config"; import axios from "axios"; import { useDispatch } from "react-redux"; import { useMutation } from "react-query"; import moment from "moment"; import { MdEmail } from "react-icons/md"; import { BiSolidLock } from "react-icons/bi"; import React, { useEffect, useState, useRef } from "react"; import Images from "../Images"; import styled from "styled-components"; import tw from "tailwind-styled-components"; import { Link, useNavigate } from "react-router-dom"; import { Formik, Form, Field } from "formik"; // import Footer from "../Component/Footer"; const Login = () => { const dispatch = useDispatch(); const navigate = useNavigate(); const loginFunction = async (body) => { return await axios.post(`${Config.domain}/customer/login`, body, { headers: { "Content-Type": "application/json ", }, }); }; const onloginSuccess = (data) => { console.log(JSON.stringify(data?.data)); localStorage.setItem("user", JSON.stringify(data?.data)); navigate("/cms"); }; const onloginError = (err) => { toast.error(err.response.data.msg || "An Error Occured", { position: toast.POSITION.TOP_LEFT, }); }; const { isLoading: loginLoading, mutate: loginMutate } = useMutation( loginFunction, { onSuccess: onloginSuccess, onError: onloginError, } ); const initialValues = { loginId: "", password: "", }; const submitHandler = (values) => { // const body = new FormData(); if (values.password.length < 8) { return toast.error("Password should be atleast 8 characters", { position: toast.POSITION.TOP_LEFT, }); } const body = { loginId: values.email, password: values.password, mode: "1", }; loginMutate(body); }; return (
{/* */}
{/* */} login_page_img
Log In Please login to your account. {({ errors }) => { //console.log(errors); return (
{/* {errors.email ? *{errors.email}* : null} */} {/* {errors.password ? ( *{errors.password}* ) : null} */} {/* Forgot Password? */} {!loginLoading && "Login"} {loginLoading && ( )}
); }}
or

Go back to{" "} home page

{/*
); }; const ErrorMsg = tw.div`bg-red-100 px-4 py-2 text-red-600 text-xs rounded-lg`; const LoginP = tw.section`h-screen overflow-hidden md:flex `; // const Logo = tw.img`h-8 w-auto mx-auto md:mt-16 mt-12 md:mx-0`; const Logo = tw.img`h-16 w-auto`; const LogoHeading = tw.div`flex justify-start `; const SubTitle = tw.h3`mb-4 text-gray-500 text-sm `; const Container = tw.div`Container flex flex-col `; const TextWrapper = tw.div` h-full w-full md:w-6/12 lg:w-4/12 relative md:overflow-x-hidden overflow-y-auto mx-2 md:pl-8`; const ImageWrapper = tw.div`hidden md:block md:w-6/12 lg:w-8/12 h-full `; const ForgotPassword = tw.p`text-cyan-500 text-sm ml-1 flex items-center justify-end`; const Center = tw.div`grow flex flex-col `; const Title = tw.h1`text-2xl mt-4 md:mt-6 text-black font-bold `; const SubmitButton = tw.button` tracking-wide font-medium bg-[#FED308] text-black w-full py-3 rounded-lg hover:bg-yellow-500 transition-all duration-200 ease-in-out flex items-center justify-center focus:shadow-outline focus:outline-none `; const MailIcon = styled(MdEmail)` ${tw`text-gray-600 absolute ml-4 top-1/2 transform -translate-y-1/2`} `; const PassIcon = styled(BiSolidLock)` ${tw`text-gray-600 absolute ml-4 top-1/2 transform -translate-y-1/2`} `; export default Login;