's'
This commit is contained in:
@@ -52,7 +52,7 @@ export default function MyRegistrationStatus() {
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
fetch(`/api/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}`)
|
||||
fetch(`/api/join/by-wechat?wechat_id=${encodeURIComponent(wechatId)}&_=${Date.now()}`, { cache: "no-store" })
|
||||
.then((r) => r.json())
|
||||
.then((d) => {
|
||||
if (d?.hasRecord) {
|
||||
@@ -83,10 +83,20 @@ export default function MyRegistrationStatus() {
|
||||
const onUpdate = () => {
|
||||
if (!cancelled) fetchStatus();
|
||||
};
|
||||
const onVisibilityChange = () => {
|
||||
if (document.visibilityState === "visible" && !cancelled) fetchStatus();
|
||||
};
|
||||
const onPageShow = (e: PageTransitionEvent) => {
|
||||
if (e.persisted && !cancelled) fetchStatus();
|
||||
};
|
||||
window.addEventListener("vip:updated", onUpdate);
|
||||
document.addEventListener("visibilitychange", onVisibilityChange);
|
||||
window.addEventListener("pageshow", onPageShow);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
window.removeEventListener("vip:updated", onUpdate);
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange);
|
||||
window.removeEventListener("pageshow", onPageShow);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user