- Split frontend/src/lib/api.ts (2042 lines) into 12 focused domain modules: client.ts (base HTTP/auth), calendar.ts, documents.ts, employees.ts, equipment.ts, feed.ts, messages.ts, notifications.ts, procurement.ts, requests.ts, utils.ts, and index.ts barrel that preserves all existing imports - Extract calendar modal state from AppShell into useCalendarModals hook - Extract CalendarModals and MobileDrawers into components/layout/ - AppShell: 745 → 460 lines, focused on layout concerns only - Fix setState-in-effect lint error with startTransition pattern - Stabilize notifications memo to prevent unnecessary re-renders - Fix flaky WS test: handle CancelledError in channels-testing cleanup - All 609 backend tests pass, TypeScript typecheck clean, ESLint clean
17 lines
674 B
TypeScript
17 lines
674 B
TypeScript
/** Helper to build URL query string from params object */
|
|
export function buildQuery(params?: Record<string, string | number | boolean | undefined | null>): string {
|
|
if (!params) return '';
|
|
const qp = new URLSearchParams();
|
|
Object.entries(params).forEach(([key, value]) => {
|
|
if (value !== undefined && value !== null && value !== '') {
|
|
qp.append(key, String(value));
|
|
}
|
|
});
|
|
const qs = qp.toString();
|
|
return qs ? `?${qs}` : '';
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export type RequestFn = (endpoint: string, options?: RequestInit) => Promise<any>;
|
|
export type GetTokenFn = () => string | null;
|