Function getApi

  • Get the shared axios client initialized by AppProvider / initApi.

    Use this anywhere you need to talk to the API (the CRUD helpers in useResource already do). Prefer it over a fresh axios instance so the base URL, auth header and 401 handling are consistent.

    Returns AxiosInstance

    The shared AxiosInstance.

    If the client has not been initialized (i.e. AppProvider has not mounted with a valid baseApiUrl/servers[].url).

    const rows = await getApi().get("/expenses");