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