"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Ajax = void 0;
const http_1 = require("../http");
const plugins_1 = require("../plugins");
const utils_1 = require("../utils");
const app_1 = require("./app");
class Ajax extends app_1.App {
    static make(op) {
        http_1.Http.ajax.make(op, this.successHandler);
        return this;
    }
    static get(op) {
        const { method = 'GET' } = op;
        http_1.Http.ajax.make(utils_1.Obj.merge(op, { method }), this.successHandler);
        return this;
    }
    static post(op) {
        const { method = 'POST', validation } = op;
        if (validation) {
            (0, plugins_1.validate)(op, this.successHandler);
        }
        http_1.Http.ajax.make(utils_1.Obj.merge(op, { method }), this.successHandler);
        return this;
    }
    static put(op) {
        const { method = 'PUT', confirm = true } = op;
        http_1.Http.ajax.make(utils_1.Obj.merge(op, { method, confirm }), this.successHandler);
        return this;
    }
    static delete(op) {
        const { method = 'DELETE', confirm = true } = op;
        http_1.Http.ajax.make(utils_1.Obj.merge(op, { method, confirm }), this.successHandler);
        return this;
    }
}
exports.Ajax = Ajax;
//# sourceMappingURL=ajax.js.map