Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 67x 4847x 4847x 2205x 2205x 4847x | // src/hooks/useApiHandler.ts
import { APIHandler } from "./api/ApiHandler";
import { AxiosRequestConfig } from "axios";
import { useWorkspace } from "@/context/WorkspaceContext";
export const useApiHandler = () => {
// Every request names the workspace the page is showing, which is what
// svc-core lists, creates and governs in (app/services/workspace.py).
const { key: workspace } = useWorkspace();
const getApiHandler = () => {
const config: AxiosRequestConfig = {
withCredentials: true, // ✅ Axios uses withCredentials, not credentials
headers: {
"Content-Type": "application/json",
// NO Authorization header - BFF adds it
},
params: { workspace },
};
return new APIHandler(import.meta.env.VITE_API_URL, null, config);
};
return { getApiHandler };
};
|