@mvx/mvc
Version:
@mvx/mvc is mvc framework on server, base on koa, @tsdi frameworks
37 lines (35 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonResult = void 0;
var tslib_1 = require("tslib");
var ResultValue_1 = require("./ResultValue");
/**
* controller method return result type of json.
* context type 'application/json'
*
* @export
* @class JsonResult
*/
var JsonResult = /** @class */ (function (_super) {
tslib_1.__extends(JsonResult, _super);
function JsonResult(data) {
var _this = _super.call(this, 'application/json') || this;
_this.data = data;
return _this;
}
JsonResult.prototype.sendValue = function (ctx) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
ctx.type = this.contentType;
ctx.body = this.data || {};
return [2 /*return*/];
});
});
};
JsonResult.ρAnn = function () {
return { "name": "JsonResult" };
};
return JsonResult;
}(ResultValue_1.ResultValue));
exports.JsonResult = JsonResult;
//# sourceMappingURL=../sourcemaps/results/JsonResult.js.map