fix(web): search 503 vs error (#34); terms/authorities list error states (#31); authority-tab a11y + dead keys (#32); authority-kind test (#37)

This commit is contained in:
2026-06-04 17:28:01 +02:00
parent 1a91b8a242
commit ff513e1712
10 changed files with 92 additions and 15 deletions
+9 -2
View File
@@ -3,6 +3,13 @@ import { keepPreviousData, useInfiniteQuery, useMutation, useQuery, useQueryClie
import { api } from "./client";
import type { components } from "./schema";
export class HttpError extends Error {
constructor(public readonly status: number) {
super(`HTTP ${status}`);
this.name = "HttpError";
}
}
type UserView = components["schemas"]["UserView"];
type LoginRequest = components["schemas"]["LoginRequest"];
@@ -291,7 +298,7 @@ export function useSearch(q: string, visibility: string | null) {
enabled: term.length > 0,
initialPageParam: 0,
queryFn: async ({ pageParam }) => {
const { data, error } = await api.GET("/api/admin/search", {
const { data, error, response } = await api.GET("/api/admin/search", {
params: {
query: {
q: term,
@@ -302,7 +309,7 @@ export function useSearch(q: string, visibility: string | null) {
},
});
if (error || !data) throw new Error("search failed");
if (error || !data) throw new HttpError(response.status);
return data;
},