fix: login persistence, username login, realtime refresh, group name uniqueness
- Remove loadFromCookie that overwrites valid localStorage auth data - Set user status to idle on first login (was empty string) - Default empty status to idle instead of away Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -5,13 +5,7 @@ const pbUrl = import.meta.env.VITE_PB_URL || window.location.origin
|
||||
|
||||
export const pb = new PocketBase(pbUrl)
|
||||
|
||||
// 认证状态持久化
|
||||
pb.authStore.loadFromCookie(document.cookie)
|
||||
|
||||
// 保存认证状态到 cookie
|
||||
pb.authStore.onChange(() => {
|
||||
document.cookie = pb.authStore.exportToCookie({ httpOnly: false, path: '/' })
|
||||
})
|
||||
// SDK v0.21+ 自动使用 localStorage 持久化,无需手动 cookie 操作
|
||||
|
||||
// 获取当前用户
|
||||
export function getCurrentUser() {
|
||||
|
||||
Reference in New Issue
Block a user