refactor: simplify auth and instrument pages
Frontend verify / commits (pull_request) Successful in 24s
Frontend verify / security (pull_request) Failing after 9s
Frontend verify / verify (pull_request) Skipped

This commit is contained in:
2026-09-29 05:45:08 +03:00
parent 32a77860c8
commit b404c1802a
38 changed files with 644 additions and 790 deletions
+13 -21
View File
@@ -14,35 +14,28 @@ type BondPeriod = NonNullable<
const BOND_STALE_TIME_MS = 30_000;
function bondQueryOptions(uid: string) {
return {
...apiQueryClient.queryOptions("get", "/api/v1/bonds/{uid}", {
params: { path: { uid } },
}),
staleTime: BOND_STALE_TIME_MS,
};
}
function useBond(identifier: string) {
const isUid
= /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(
identifier,
);
const byUid = useResourceQuery({
...bondQueryOptions(identifier),
enabled: Boolean(identifier) && isUid,
});
// eslint-disable-next-line unicorn/prefer-minimal-ternary -- Hoisting params breaks the generated union of endpoint request shapes.
const init = isUid
? { params: { path: { uid: identifier } } }
: { params: { path: { ticker: identifier } } };
const byTicker = useResourceQuery({
...apiQueryClient.queryOptions("get", "/api/v1/bonds/by-ticker/{ticker}", {
params: { path: { ticker: identifier } },
}),
enabled: Boolean(identifier) && !isUid,
const options = apiQueryClient.queryOptions(
"get",
isUid ? "/api/v1/bonds/{uid}" : "/api/v1/bonds/by-ticker/{ticker}",
init,
);
return useResourceQuery({
...options,
enabled: Boolean(identifier),
staleTime: BOND_STALE_TIME_MS,
});
return isUid ? byUid : byTicker;
}
function useBondCandles(uid: string, period: BondPeriod) {
@@ -110,7 +103,6 @@ function useBondSearch(query: string) {
export {
type BondCoupons,
type BondMetrics,
type BondPeriod,
MIN_BOND_SEARCH_LENGTH,
useBond,
useBondCandles,
-1
View File
@@ -1,7 +1,6 @@
export {
type BondCoupons,
type BondMetrics,
type BondPeriod,
MIN_BOND_SEARCH_LENGTH,
useBond,
useBondCandles,