import { Config } from "../app";
import { Sweet, Url } from "../utils";
export class Success {
    constructor(op, res) {
        this.op = op;
        this.res = res;
    }
    static handle(op, res) {
        if (Config.app_env) {
            console.log('success op', op);
            console.log('success response', res);
        }
        if (res?.tost) {
            Sweet.tost.success({ text: res?.data?.alert, timer: 600, position: 'bottom-end', });
            if (res?.reload) {
                Url.resetTable(op.api);
            }
            if (res?.data?.redirect) {
                Url.redirectTimeout(res?.data?.redirect, res?.timeout ?? 1200);
            }
        }
        if (res?.sweet) {
            Sweet.success({ text: res?.data?.alert });
            if (res?.reload) {
                Url.resetTable(op.api);
            }
            if (res?.data?.redirect) {
                Url.redirectTimeout(res?.data?.redirect, res?.timeout ?? 1200);
            }
        }
        return this;
    }
}
//# sourceMappingURL=success.js.map