fix: clear cached store data on logout to prevent user data leakage (#6665)

This commit is contained in:
Hayden
2025-12-06 11:36:39 -06:00
committed by GitHub
parent 1f19133870
commit 05f648d7fb
12 changed files with 91 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { ref, computed } from "vue";
import type { UserOut } from "~/lib/api/types/user";
import { clearAllStores } from "~/composables/store";
interface AuthData {
value: UserOut | null;
@@ -101,6 +102,13 @@ export const useAuthBackend = function (): AuthState {
setToken(null);
authUser.value = null;
authStatus.value = "unauthenticated";
// Clear all cached store data to prevent data leakage between users
clearAllStores();
// Clear Nuxt's useAsyncData cache
clearNuxtData();
await router.push(callbackUrl || "/login");
}
}