feat: add GameGroup2 project with frontend and backend

- Add .gitignore for Node.js and PocketBase projects
- Add frontend (Vue 3 + Vite + TypeScript)
- Add backend (PocketBase)
- Add deployment scripts and Docker compose configs

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
congsh
2026-04-17 15:45:54 +08:00
parent 2db391901c
commit 2ce8985747
56 changed files with 3981 additions and 783 deletions
+32
View File
@@ -0,0 +1,32 @@
// src/api/pocketbase.ts
import PocketBase from 'pocketbase'
const pbUrl = import.meta.env.VITE_PB_URL || '/api'
export const pb = new PocketBase(pbUrl)
// 认证状态持久化
pb.authStore.loadFromCookie(document.cookie)
// 保存认证状态到 cookie
pb.authStore.onChange(() => {
document.cookie = pb.authStore.exportToCookie({ httpOnly: false })
})
// 获取当前用户
export function getCurrentUser() {
return pb.authStore.model
}
// 检查是否已登录
export function isAuthenticated(): boolean {
return pb.authStore.isValid
}
// 登出
export function logout() {
pb.authStore.clear()
window.location.href = '/login'
}
export default pb