APIClient is a wrapper based on axios, used to request NocoBase resource actions on the client side via HTTP.
axiosThe axios instance, which can be used to access the axios API, for example, apiClient.axios.interceptors.
authClient-side authentication class, see Auth.
storageClient-side storage class, see Storage.
constructor()Constructor, creates an APIClient instance.
constructor(instance?: APIClientOptions)request()Initiates an HTTP request.
request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D> | ResourceActionOptions): Promise<R>General axios request parameters. See Request Config.
NocoBase resource action request parameters.
| Property | Type | Description |
|---|---|---|
resource | string | 1. Resource name, e.g., a2. Name of the resource's associated object, e.g., a.b |
resourceOf | any | When resource is the name of the resource's associated object, it is the primary key value of the resource. For example, for a.b, it represents the primary key value of a. |
action | string | Action name |
params | any | Request parameter object, mainly URL parameters. The request body is placed in params.values. |
params.values | any | Request body object |
resource()Gets the NocoBase resource action method object.
resource(name: string, of?: any, headers?: AxiosRequestHeaders): IResource| Parameter | Type | Description |
|---|---|---|
name | string | 1. Resource name, e.g., a2. Name of the resource's associated object, e.g., a.b |
of | any | When name is the name of the resource's associated object, it is the primary key value of the resource. For example, for a.b, it represents the primary key value of a. |
headers | AxiosRequestHeaders | HTTP headers to include in subsequent resource action requests. |