@omegabigdata/honoplay-redux-helper
Version:
honoplay-redux-helper
85 lines (73 loc) • 2.58 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fetchQuestionCategoryList = exports.updateQuestionCategory = exports.createQuestionCategory = void 0;
var _QuestionCategory = require("../helpers/ActionTypes/QuestionCategory");
var _honoplayApiHelperNode = require("@omegabigdata/honoplay-api-helper-node");
var createQuestionCategory = function createQuestionCategory(questionCategoryModel) {
return function (dispatch) {
dispatch({
type: _QuestionCategory.CREATING_QUESTİON_CATEGORY
});
_honoplayApiHelperNode.QuestionCategory.postQuestionCategory(questionCategoryModel, function (success) {
dispatch({
type: _QuestionCategory.CREATE__QUESTİON_CATEGORY_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _QuestionCategory.CREATE_QUESTİON_CATEGORY_FAILED,
data: {
error: error
}
});
});
};
};
exports.createQuestionCategory = createQuestionCategory;
var updateQuestionCategory = function updateQuestionCategory(questionCategoryModel) {
return function (dispatch) {
dispatch({
type: _QuestionCategory.UPDATING_QUESTİON_CATEGORY
});
_honoplayApiHelperNode.QuestionCategory.putQuestionCategoryModel(questionCategoryModel, function (success) {
dispatch({
type: _QuestionCategory.UPDATE_QUESTİON_CATEGORY_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _QuestionCategory.UPDATE_QUESTİON_CATEGORY_FAILED,
data: {
error: error
}
});
});
};
};
exports.updateQuestionCategory = updateQuestionCategory;
var fetchQuestionCategoryList = function fetchQuestionCategoryList() {
var skip = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var take = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return function (dispatch) {
dispatch({
type: _QuestionCategory.FETCHING_QUESTİON_CATEGORY_LIST
});
_honoplayApiHelperNode.QuestionCategory.getQuestionCategories(skip, take, function (success) {
dispatch({
type: _QuestionCategory.FETCH_QUESTİON_CATEGORY_LIST_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _QuestionCategory.FETCH_QUESTİON_CATEGORY_LIST_FAILED,
data: {
error: error
}
});
});
};
};
exports.fetchQuestionCategoryList = fetchQuestionCategoryList;
//# sourceMappingURL=QuestionCategory.js.map