laravel-form-validation
Version:
Yet another form validation helper for Laravel
78 lines (77 loc) • 1.9 kB
TypeScript
import { AxiosError, AxiosRequestConfig } from 'axios';
import Errors from './Errors';
declare class Form {
static $defaults: Object | any;
$progress: Number;
$pending: Boolean;
$errors: Errors;
/**
* Create a new Form instance.
* @return {Form}
*/
constructor();
/**
* Make a get request.
*
* @param {String} url
* @param {Object} params
* @returns {Promise}
*/
get(url: string, params?: Object): Promise<any>;
/**
* Make a post request.
*
* @param {String} url
* @param {Object} data
* @returns {Promise}
*/
post(url: string, data?: Object): Promise<any>;
/**
* Make a patch request.
*
* @param {String} url
* @param {Object} data
* @returns {Promise}
*/
patch(url: string, data?: Object): Promise<any>;
/**
* Make a put request.
*
* @param {String} url
* @param {Object} data
* @returns {Promise}
*/
put(url: string, data?: Object): Promise<any>;
/**
* Make a delete request.
*
* @param {String} url
* @param {Object} data
* @returns {Promise}
*/
delete(url: string, data?: Object): Promise<any>;
/**
* Submit the form to the given URL using the method specified.
*
* @param {String} method
* @param {String} url
* @param {Object} data
* @param {Object} config
* @return {Promise}
*/
submit(method: string, url: string, data?: any, config?: AxiosRequestConfig): Promise<any>;
/**
* Returns the axios configuration object.
*
* @source https://github.com/axios/axios#request-config
* @return {Object}
*/
axiosConfig(): AxiosRequestConfig;
/**
* Handle a error response.
*
* @param {AxiosError} error
*/
onFail(error: AxiosError): void;
}
export default Form;