UNPKG

@omegabigdata/honoplay-redux-helper

Version:
109 lines (94 loc) 2.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateTenant = exports.createTenant = exports.fetchTenantList = exports.fetchTenant = void 0; var _Tenant = require("../helpers/ActionTypes/Tenant"); var _honoplayApiHelperNode = require("@omegabigdata/honoplay-api-helper-node"); var fetchTenantList = function fetchTenantList() { 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: _Tenant.FETCHING_TENANT_LIST }); _honoplayApiHelperNode.Tenant.getTenants(skip, take, function (success) { dispatch({ type: _Tenant.FETCH_TENANT_LIST_SUCCESS, data: success.data }); }, function (error) { dispatch({ type: _Tenant.FETCH_TENANT_LIST_FAILED, data: { error: error } }); }); }; }; exports.fetchTenantList = fetchTenantList; var fetchTenant = function fetchTenant(tenantId) { return function (dispatch) { dispatch({ type: _Tenant.FETCHING_TENANT }); _honoplayApiHelperNode.Tenant.getTenant(tenantId, function (success) { dispatch({ type: _Tenant.FETCH_TENANT_SUCCESS, data: success.data }); }, function (error) { dispatch({ type: _Tenant.FETCH_TENANT_FAILED, data: { error: error } }); }); }; }; exports.fetchTenant = fetchTenant; var createTenant = function createTenant(tenantModel) { return function (dispatch) { dispatch({ type: _Tenant.CREATING_TENANT }); _honoplayApiHelperNode.Tenant.postTenant(tenantModel, function (success) { dispatch({ type: _Tenant.CREATE_TENANT_SUCCESS, data: success.data }); }, function (error) { dispatch({ type: _Tenant.CREATE_TENANT_FAILED, data: { error: error } }); }); }; }; exports.createTenant = createTenant; var updateTenant = function updateTenant(tenantModel) { return function (dispatch) { dispatch({ type: _Tenant.UPDATING_TENANT }); _honoplayApiHelperNode.Tenant.putTenant(tenantModel, function (success) { dispatch({ type: _Tenant.UPDATE_TENANT_SUCCESS, data: success.data }); }, function (error) { dispatch({ type: _Tenant.UPDATE_TENANT_FAILED, data: { error: error } }); }); }; }; exports.updateTenant = updateTenant; //# sourceMappingURL=Tenant.js.map