fix: tokn timeout redirect
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState } from "react";
|
||||||
import { motion, Variants } from "framer-motion";
|
import { motion, Variants } from "framer-motion";
|
||||||
import { useNavigate } from "@tanstack/react-router";
|
import { useNavigate } from "@tanstack/react-router";
|
||||||
import { useApiMutation } from "../../utils/useApiRequest";
|
import { useApiMutation } from "../../utils/useApiRequest";
|
||||||
@@ -52,12 +52,6 @@ const Login: React.FC = () => {
|
|||||||
disableBackdrop: false,
|
disableBackdrop: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (phoneNumber && phoneNumber.length >= 10) {
|
|
||||||
handleGetCaptcha();
|
|
||||||
}
|
|
||||||
}, [phoneNumber]);
|
|
||||||
|
|
||||||
const handleGetCaptcha = async () => {
|
const handleGetCaptcha = async () => {
|
||||||
try {
|
try {
|
||||||
const data = await mutationCaptcha.mutateAsync({
|
const data = await mutationCaptcha.mutateAsync({
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ api.interceptors.request.use(
|
|||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
(error) => Promise.reject(error)
|
(error) => Promise.reject(error),
|
||||||
);
|
);
|
||||||
|
|
||||||
api.interceptors.response.use(
|
api.interceptors.response.use(
|
||||||
@@ -50,12 +50,13 @@ api.interceptors.response.use(
|
|||||||
rtl: true,
|
rtl: true,
|
||||||
});
|
});
|
||||||
if (typeof logOut === "function") {
|
if (typeof logOut === "function") {
|
||||||
|
window.location.href = "/";
|
||||||
logOut();
|
logOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export default api;
|
export default api;
|
||||||
|
|||||||
Reference in New Issue
Block a user