feat : add back btn to shop page in login form
This commit is contained in:
@@ -15,7 +15,7 @@ import useAxios from "../../../hooks/useAxios";
|
|||||||
const LoginEmailForm = () => {
|
const LoginEmailForm = () => {
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const axios = useAxios()
|
const axios = useAxios();
|
||||||
const mutationEmail = useMutation({
|
const mutationEmail = useMutation({
|
||||||
mutationFn: (values: { email: string; password: string }) => {
|
mutationFn: (values: { email: string; password: string }) => {
|
||||||
return axios.post("/login", values);
|
return axios.post("/login", values);
|
||||||
@@ -27,8 +27,12 @@ const LoginEmailForm = () => {
|
|||||||
password: "",
|
password: "",
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
email: Yup.string().email("ایمیل نامعتبر است"),
|
email: Yup.string()
|
||||||
password: Yup.string().min(6, "رمز عبور حداقل باید 6 کاراکتر باشد"),
|
.email("ایمیل نامعتبر است")
|
||||||
|
.required("این فیلد الزامی است"),
|
||||||
|
password: Yup.string()
|
||||||
|
.min(6, "رمز عبور حداقل باید 6 کاراکتر باشد")
|
||||||
|
.required("این فیلد الزامی است"),
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
toast.promise(mutationEmail.mutateAsync(values), {
|
toast.promise(mutationEmail.mutateAsync(values), {
|
||||||
@@ -107,7 +111,8 @@ const LoginEmailForm = () => {
|
|||||||
</motion.div>
|
</motion.div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full h-full grid grid-cols-1">
|
<div className="w-full h-full grid grid-cols-2 gap-2">
|
||||||
|
<Button onClick={() => navigate("/")}> بازگشت </Button>
|
||||||
<Button extra="py-2" type="submit">
|
<Button extra="py-2" type="submit">
|
||||||
ورود
|
ورود
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const LoginMobileForm = ({
|
|||||||
loading: "در حال ارسال کد...",
|
loading: "در حال ارسال کد...",
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
dispatch(setToken(res?.data?.result?.token));
|
dispatch(setToken(res?.data?.result?.token));
|
||||||
setisShowLoginNumberOrEmail(false)
|
setisShowLoginNumberOrEmail(false);
|
||||||
setStepMobile(2);
|
setStepMobile(2);
|
||||||
return `${res.data.alert}`;
|
return `${res.data.alert}`;
|
||||||
},
|
},
|
||||||
@@ -223,7 +223,8 @@ const LoginMobileForm = ({
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full h-full grid grid-cols-1">
|
<div className="w-full h-full grid grid-cols-2 gap-2">
|
||||||
|
<Button onClick={() => navigate("/")}> بازگشت </Button>
|
||||||
<Button extra="py-2" type="submit">
|
<Button extra="py-2" type="submit">
|
||||||
{stepMobile === 1 ? "دریافت کد" : "ورود"}
|
{stepMobile === 1 ? "دریافت کد" : "ورود"}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user