fix(web): code review pass — scroll watch, SSE same-origin, store concurrency, modal reset, admin validation

This commit is contained in:
2026-05-04 20:58:48 +08:00
parent ff283013da
commit b8d29d8ea7
11 changed files with 145 additions and 85 deletions
+12
View File
@@ -75,3 +75,15 @@ export async function request<T>(path: string, opts: RequestOptions = {}): Promi
clearTimeout(timer)
}
}
// buildQuery 把任意对象拼成 "?k=v&..." 形式;undefined / null / '' 跳过;
// 数组与对象用 String() 退化(业务侧目前没有数组 query 需求)。
export function buildQuery(params: object): string {
const q = new URLSearchParams()
for (const [k, v] of Object.entries(params)) {
if (v === undefined || v === null || v === '') continue
q.set(k, String(v))
}
const s = q.toString()
return s ? '?' + s : ''
}