"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Success = void 0;
const app_1 = require("../app");
const utils_1 = require("../utils");
class Success {
    constructor(op, res) {
        this.op = op;
        this.res = res;
    }
    static handle(op, res) {
        if (app_1.Config.app_env) {
            console.log('success op', op);
            console.log('success response', res);
        }
        if (res?.tost) {
            utils_1.Sweet.tost.success({ text: res?.data?.alert, timer: 600, position: 'bottom-end', });
            if (res?.reload) {
                utils_1.Url.resetTable(op.api);
            }
            if (res?.data?.redirect) {
                utils_1.Url.redirectTimeout(res?.data?.redirect, res?.timeout ?? 1200);
            }
        }
        if (res?.sweet) {
            utils_1.Sweet.success({ text: res?.data?.alert });
            if (res?.reload) {
                utils_1.Url.resetTable(op.api);
            }
            if (res?.data?.redirect) {
                utils_1.Url.redirectTimeout(res?.data?.redirect, res?.timeout ?? 1200);
            }
        }
        return this;
    }
}
exports.Success = Success;
//# sourceMappingURL=success.js.map