@omegabigdata/honoplay-redux-helper
Version:
honoplay-redux-helper
109 lines (94 loc) • 2.95 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.fetchContentFile = exports.fetchContentFileList = exports.updateContentFile = exports.createContentFile = void 0;
var _ContentFile = require("../helpers/ActionTypes/ContentFile");
var _honoplayApiHelperNode = require("@omegabigdata/honoplay-api-helper-node");
var createContentFile = function createContentFile(contentFileModel) {
return function (dispatch) {
dispatch({
type: _ContentFile.CREATING_CONTENT_FILE
});
_honoplayApiHelperNode.ContentFile.postContentFile(contentFileModel, function (success) {
dispatch({
type: _ContentFile.CREATE_CONTENT_FILE_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _ContentFile.CREATE_CONTENT_FILE_FAILED,
data: {
error: error
}
});
});
};
};
exports.createContentFile = createContentFile;
var updateContentFile = function updateContentFile(contentFileModel) {
return function (dispatch) {
dispatch({
type: _ContentFile.UPDATING_CONTENT_FILE
});
_honoplayApiHelperNode.ContentFile.putContentFile(contentFileModel, function (success) {
dispatch({
type: _ContentFile.UPDATE_CONTENT_FILE_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _ContentFile.UPDATE_CONTENT_FILE_FAILED,
data: {
error: error
}
});
});
};
};
exports.updateContentFile = updateContentFile;
var fetchContentFileList = function fetchContentFileList() {
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: _ContentFile.FETCHING_CONTENT_FILE_LIST
});
_honoplayApiHelperNode.ContentFile.getContentFiles(skip, take, function (success) {
dispatch({
type: _ContentFile.FETCH_CONTENT_FILE_LIST_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _ContentFile.FETCH_CONTENT_FILE_LIST_FAILED,
data: {
error: error
}
});
});
};
};
exports.fetchContentFileList = fetchContentFileList;
var fetchContentFile = function fetchContentFile(contentFileId) {
return function (dispatch) {
dispatch({
type: _ContentFile.FETCHING_CONTENT_FILE
});
_honoplayApiHelperNode.ContentFile.getContentFile(contentFileId, function (success) {
dispatch({
type: _ContentFile.FETCH_CONTENT_FILE_SUCCESS,
data: success.data
});
}, function (error) {
dispatch({
type: _ContentFile.FETCH_CONTENT_FILE_FAILED,
data: {
error: error
}
});
});
};
};
exports.fetchContentFile = fetchContentFile;
//# sourceMappingURL=ContentFile.js.map