Remove callApi, refactor API integrations, and adjust error handling

- Delete unused `callApi` utility and related imports across components.
- Replace `callApi` with direct `fetch` usage in `validateCustomer` and `addCustomer`.
- Update `customerRoutes` to include `/api` prefix for consistency.
- Refactor `useErrorHandler` to ensure comprehensive state management during errors.
- Improve `ErrorBoundary` component text for better clarity in fallback UI.
- Align `CustomersPage` logic with `useCallback` for optimized dependency management.
This commit is contained in:
2025-07-11 20:21:45 +02:00
parent 86be1e8920
commit 0724f3b1e7
9 changed files with 84 additions and 54 deletions

View File

@@ -7,7 +7,7 @@ export async function serverCall(
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
body?: unknown
): Promise<Response> {
const url = `${process.env.INTERNAL_BACKEND_URL ?? "http://localhost:8080"}/api${path}`;
const url = `${process.env.INTERNAL_BACKEND_URL ?? "http://localhost:8080"}${path}`;
const session = await getServerSession(authOptions);
const headers: Record<string, string> = {