feat: implement cross-tab logout synchronization using storage event broadcasting

This commit is contained in:
pradeepkumar
2026-04-15 23:52:05 +05:30
parent c60978aea1
commit 5cac15d742
2 changed files with 35 additions and 0 deletions

View File

@@ -13,6 +13,9 @@ export default function LogoutPage() {
localStorage.setItem('isLoggingOut', 'true');
localStorage.removeItem('accessToken');
localStorage.removeItem('refreshToken');
// Broadcast to other open tabs so they also log out.
// 'storage' events only fire in OTHER tabs, not the one that wrote the value.
localStorage.setItem('re-quest-logout-broadcast', String(Date.now()));
}
useEffect(() => {