refactor(web/auth): extract user state to break auth<->player cycle (B2)

This commit is contained in:
2026-05-08 10:49:39 -04:00
parent 68af48bb37
commit 909b36d5ad
3 changed files with 32 additions and 19 deletions
+19
View File
@@ -0,0 +1,19 @@
// User state lives here so auth/store and player/store can share it
// without a circular import. auth/store mutates via setUser; player/store
// reads only. Both auth-flow consumers (login/register/logout) and any
// component that needs the current user can import `user` from either
// this module or auth/store — auth/store re-exports it for backward
// compatibility.
import type { User } from '$lib/api/client';
let _user = $state<User | null>(null);
export const user = {
get value(): User | null {
return _user;
}
};
export function setUser(u: User | null): void {
_user = u;
}