Repository
Pinia ORM Axios adds supporting properties and methods to the Model
object.
Static Properties
axios
- Type:
AxiosInstance | null
The axios instance which was either set during plugin installation or set using thesetAxios
method. Pinia ORM Axios will use this axios instance to perform requests.
apiConfig
- Type:
Object
- Default:
{}
The property that holds the model configuration for requests.
globalApiConfig
- Type:
Object
The property that holds the global configuration. The value will be set automatically during the plugin installation process.
::: warning WARNING Do not mutate this property programmatically. :::
Static Methods
api
api(): Request
Return a newly created Request instance.
setAxios
setAxios(axios: AxiosInstance): void
Set the axios instance manually. Typical setups will configure the axios instance during installation. However, in some cases (mostly with Nuxt), you may need to set the axios instance at a later stage.
::: warning IMPORTANT If you omit the axios instance during installation, it's important that one is set usingsetAxios
before any attempt to make an API request. :::
See also: Nuxt.js Integration
GuideCustom ActionsThe Custom Actions lets you define your own predefined api methods. You can define any number of custom actions through your Model configurations through actions option.ApiRequestThe Request object is returned when calling the api() method on a repository. This object is the foundation for Pinia ORM Axios and enables you to call many of the supported axios methods to perform an API request. Any Custom Actions will also be defined on the Request object.