mirror of
https://github.com/docmost/docmost.git
synced 2026-05-25 20:12:45 +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 () => {
|
const handleLogout = async () => {
|
||||||
setCurrentUser(RESET);
|
setCurrentUser(RESET);
|
||||||
await logout();
|
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`);
|
window.location.replace(`${APP_ROUTE.AUTH.LOGIN}?logout=1`);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user