mirror of
https://github.com/labring/FastGPT.git
synced 2025-12-25 20:02:47 +00:00
fix clear token
This commit is contained in:
parent
b10dd03f42
commit
4102d0f463
|
|
@ -27,11 +27,13 @@ const ActivityAdModal = () => {
|
|||
const router = useRouter();
|
||||
|
||||
// Check if ad was recently closed
|
||||
const [closedData, setClosedData] = useLocalStorageState<string>(CLOSED_AD_KEY);
|
||||
const [closedData, setClosedData] = useLocalStorageState<string>(CLOSED_AD_KEY, {
|
||||
listenStorageChange: true
|
||||
});
|
||||
|
||||
const { data } = useRequest2(
|
||||
async () => {
|
||||
if (!feConfigs?.isPlus) return;
|
||||
if (!feConfigs?.isPlus || !userInfo) return;
|
||||
return getActivityAd();
|
||||
},
|
||||
{
|
||||
|
|
@ -59,7 +61,8 @@ const ActivityAdModal = () => {
|
|||
if (res?.activityAdImage && shouldShowAd) {
|
||||
onOpen();
|
||||
}
|
||||
}
|
||||
},
|
||||
refreshDeps: [userInfo]
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,29 @@ const clearOperationalAdStorage = () => {
|
|||
console.error('Failed to clear operational ad storage:', error);
|
||||
}
|
||||
};
|
||||
const clearActivityAdStorage = () => {
|
||||
try {
|
||||
const key = 'activity_ad_closed';
|
||||
const oldValue = localStorage.getItem(key);
|
||||
localStorage.removeItem(key);
|
||||
|
||||
// Dispatch ahooks sync event to update useLocalStorageState
|
||||
if (oldValue !== null) {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('AHOOKS_SYNC_STORAGE_EVENT_NAME', {
|
||||
detail: {
|
||||
key,
|
||||
newValue: null,
|
||||
oldValue,
|
||||
storageArea: localStorage
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to clear activity ad storage:', error);
|
||||
}
|
||||
};
|
||||
|
||||
export const clearToken = () => {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue