fix: login persistence, username login, realtime refresh, group name uniqueness

- Fix cookie path to '/' for auth persistence across page refreshes
- Login field now accepts both username and email
- Add 30s polling for group list and team session status refresh
- Add group name uniqueness check before creation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
congsh
2026-04-18 01:24:12 +08:00
parent c76346294a
commit 9405406c47
4 changed files with 35 additions and 10 deletions
@@ -4,6 +4,7 @@ import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { useGroupStore } from '@/stores/group'
import { createGroup } from '@/api/groups'
import pb from '@/api/pocketbase'
const props = defineProps<{
modelValue: boolean
@@ -33,7 +34,20 @@ async function handleSubmit() {
ElMessage.warning('请输入群组名称')
return
}
// 检查群组名是否重复
loading.value = true
try {
const existing = await pb.collection('groups').getList(1, 1, {
filter: `name="${form.value.name.trim()}"`
})
if (existing.items.length > 0) {
ElMessage.warning('该群组名称已存在,请换一个')
loading.value = false
return
}
} catch { /* ignore */ }
try {
const group = await createGroup({
name: form.value.name.trim(),