mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 16:44:05 +08:00
fix(auth): clear page indexeddb databases on logout
This commit is contained in:
@@ -166,6 +166,18 @@ export default function useAuth() {
|
||||
const handleLogout = async () => {
|
||||
setCurrentUser(RESET);
|
||||
await logout();
|
||||
|
||||
try {
|
||||
if (typeof indexedDB?.databases === "function") {
|
||||
const dbs = await indexedDB.databases();
|
||||
dbs
|
||||
.filter((db) => db.name?.startsWith("page."))
|
||||
.forEach((db) => indexedDB.deleteDatabase(db.name!));
|
||||
}
|
||||
} catch {
|
||||
//
|
||||
}
|
||||
|
||||
window.location.replace(`${APP_ROUTE.AUTH.LOGIN}?logout=1`);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user