chore(frontend): tighten eslint/axe gates, remove reader waivers (B5 done, spec ② complete)
This commit is contained in:
@@ -31,6 +31,18 @@ export async function adminApi(): Promise<APIRequestContext> {
|
||||
return request.newContext({ baseURL: BASE, extraHTTPHeaders: { Authorization: `Bearer ${token}` } });
|
||||
}
|
||||
|
||||
/** adminApi 登录带 429 退避重试:三 spec 并发 worker 的登录总数可能顶到后端 1min/5 次限流门,等窗口即可;仅消耗等待预算,不改用例语义 */
|
||||
export async function adminApiRetry(): Promise<APIRequestContext> {
|
||||
for (let i = 0; ; i++) {
|
||||
try {
|
||||
return await adminApi();
|
||||
} catch (e) {
|
||||
if (i > 20 || !(e instanceof Error) || !e.message.includes("HTTP 429")) throw e;
|
||||
await new Promise((r) => setTimeout(r, 3000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function ensureLibrary(ctx: APIRequestContext, name: string): Promise<number> {
|
||||
const libs = (await (await ctx.get("/api/libraries")).json()) as { id: number; name: string }[];
|
||||
const hit = libs.find((l) => l.name === name);
|
||||
|
||||
Reference in New Issue
Block a user