import { Http } from '../http';
import { validate } from '../plugins';
import { Obj } from '../utils';
import { App } from './app';
export class Ajax extends App {
    static make(op) {
        Http.ajax.make(op, this.successHandler);
        return this;
    }
    static get(op) {
        const { method = 'GET' } = op;
        Http.ajax.make(Obj.merge(op, { method }), this.successHandler);
        return this;
    }
    static post(op) {
        const { method = 'POST', validation } = op;
        if (validation) {
            validate(op, this.successHandler);
        }
        Http.ajax.make(Obj.merge(op, { method }), this.successHandler);
        return this;
    }
    static put(op) {
        const { method = 'PUT', confirm = true } = op;
        Http.ajax.make(Obj.merge(op, { method, confirm }), this.successHandler);
        return this;
    }
    static delete(op) {
        const { method = 'DELETE', confirm = true } = op;
        Http.ajax.make(Obj.merge(op, { method, confirm }), this.successHandler);
        return this;
    }
}
//# sourceMappingURL=ajax.js.map