@vuex-orm/plugin-axios
Version:
Vuex ORM plugin for adding smooth integration with axios.
58 lines • 1.91 kB
TypeScript
import { AxiosResponse } from 'axios';
import { Model, Record, Collections } from '@vuex-orm/core';
import { Config, PersistMethods, PersistOptions } from '../contracts/Config';
export declare class Response {
/**
* The model that called the request.
*/
model: typeof Model;
/**
* The request configuration.
*/
config: Config;
/**
* The axios response instance.
*/
response: AxiosResponse;
/**
* Entities created by Vuex ORM.
*/
entities: Collections | null;
/**
* Whether if response data is saved to the store or not.
*/
isSaved: boolean;
/**
* Create a new response instance.
*/
constructor(model: typeof Model, config: Config, response: AxiosResponse);
/**
* Save response data to the store.
*/
save(): Promise<void>;
/**
* Delete the entity record where the `delete` option is configured.
*/
delete(): Promise<void>;
/**
* Get the response data from the axios response object. If a `dataTransformer`
* option is configured, it will be applied to the response object. If the
* `dataKey` option is configured, it will return the data from the given
* property within the response body.
*/
getDataFromResponse(): Record | Record[];
/**
* Get persist options if any set in config.
*/
protected getPersistOptions(): PersistOptions | undefined;
/**
* Validate the given data to ensure the Vuex ORM persist methods accept it.
*/
protected validateData(data: any): data is Record | Record[];
/**
* Validate the given string as to ensure it correlates with the available
* Vuex ORM persist methods.
*/
protected validatePersistAction(action: string): action is PersistMethods;
}
//# sourceMappingURL=Response.d.ts.map