@veloiq/ui connect your React application to the VeloIQ backend: authProvider handles JWT login and session management, accessControlProvider reads role permissions and hides or disables unauthorized UI elements, and httpClient is an Axios instance that attaches the JWT to every API request. All three implement the corresponding Refine provider interfaces and are passed directly to the <Refine> component.
authProvider
authProvider implements Refine’s AuthProvider interface. It communicates with the VeloIQ backend’s /auth/ endpoints and stores credentials in localStorage.
accessControlProvider
accessControlProvider implements Refine’s AccessControlProvider interface. It mirrors the backend’s three-layer permission model entirely in the browser using cached data from localStorage — no additional network request is made per permission check.
Permission layers
Built-in fallback permissions
When no cached permissions are available (e.g. before the first login), the provider falls back to:Admin users bypass all permission checks — the
can function returns { can: true } immediately for any user whose roles include "admin" (case-insensitive).buttons.hideIfUnauthorized: true, so Refine automatically hides action buttons the current user cannot access.
httpClient
httpClient is a pre-configured Axios instance with a request interceptor that reads jm_access_token from localStorage and sets the Authorization: Bearer <token> header on every outgoing request.
httpClient to @refinedev/simple-rest’s data provider to ensure all Refine data operations are authenticated:
API_URL
API_URL is the base URL constant used by the providers and the data provider. Its default value is "/api".
/api requests to the backend, or replace API_URL with your own constant:
LoginPage
LoginPage is the pre-built login page component. It renders a username/password form and delegates to authProvider.login().
Wiring providers in App.tsx
The following is the complete provider setup from the task-manager sample application.UI Overview
All exports from
@veloiq/ui at a glance.DynamicResource
Schema-driven CRUD pages and the ModelDef type reference.