购买会员页面加上轮询

This commit is contained in:
yezian 2024-04-25 20:53:49 +08:00
parent dc16e096af
commit 59dace7c2b
1 changed files with 38 additions and 33 deletions

View File

@ -36,7 +36,6 @@ export default function Vip() {
const [isVip, setIsVip] = useState(false);
const [name, setName] = useState("");
const [isFetching, setIsFetching] = useState(true);
useEffect(() => {
const getUserData = async () => {
try {
const base = webviewBaseRequest();
@ -71,9 +70,15 @@ export default function Vip() {
console.error(error);
}
};
//
useEffect(() => {
setTimeout(() => {
getUserData();
}, 500);
const intervalId = setInterval(() => {
getUserData();
}, 2000);
return () => clearInterval(intervalId);
}, []);
//