本文整理汇总了TypeScript中reduxsauce.createActions函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createActions函数的具体用法?TypeScript createActions怎么用?TypeScript createActions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createActions函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: camelToScreamingSnake
export const createActions = (actions) => {
const { Creators: Actions } = sauce.createActions(actions);
Object.keys(actions).forEach((key) => {
Actions[key].toString = () => camelToScreamingSnake(key);
});
return Actions;
};
示例2: createActions
export const { Types: RisksTypes, Creators: RisksActions } = createActions({
fetchRisks: ['teamspace', 'modelId', 'revision'],
fetchRisksSuccess: ['risks'],
fetchRisk: ['teamspace', 'modelId', 'riskId'],
fetchRiskSuccess: ['risk'],
fetchRiskFailure: [],
setComponentState: ['componentState'],
saveRisk: ['teamspace', 'model', 'riskData', 'revision'],
updateRisk: ['teamspace', 'modelId', 'riskData'],
postComment: ['teamspace', 'modelId', 'riskData'],
removeComment: ['teamspace', 'modelId', 'riskData'],
saveRiskSuccess: ['risk'],
setNewRisk: [],
renderPins: [],
printRisks: ['teamspace', 'modelId'],
downloadRisks: ['teamspace', 'modelId'],
showDetails: ['teamspace', 'model', 'revision', 'risk'],
closeDetails: ['teamspace', 'model', 'revision'],
setActiveRisk: ['risk', 'revision'],
showNewPin: ['risk', 'pinData'],
togglePendingState: ['isPending'],
toggleDetailsPendingState: ['isPending'],
subscribeOnRiskChanges: ['teamspace', 'modelId'],
unsubscribeOnRiskChanges: ['teamspace', 'modelId'],
focusOnRisk: ['risk', 'revision'],
toggleShowPins: ['showPins'],
subscribeOnRiskCommentsChanges: ['teamspace', 'modelId', 'riskId'],
unsubscribeOnRiskCommentsChanges: ['teamspace', 'modelId', 'riskId'],
createCommentSuccess: ['comment', 'riskId'],
deleteCommentSuccess: ['commentGuid', 'riskId'],
updateCommentSuccess: ['comment', 'riskId'],
toggleSortOrder: ['sortOrder'],
updateNewRisk: ['newRisk'],
setFilters: ['filters'],
showCloseInfo: ['riskId'],
resetComponentState: []
}, { prefix: 'RISKS/' });
示例3: createActions
import { sortByField } from '../../helpers/sorting';
export const { Types: UserManagementTypes, Creators: UserManagementActions } = createActions({
fetchTeamspaceDetails: ['teamspace'],
fetchTeamspaceDetailsSuccess: ['teamspace', 'users', 'currentUser', 'collaboratorLimit'],
setPendingState: ['isPending'],
addUser: ['user'],
addUserSuccess: ['user', 'currentUser'],
removeUser: ['username'],
removeUserCascade: ['username'],
removeUserSuccess: ['username'],
setTeamspace: ['teamspace'],
updateJob: ['username', 'job'],
updateUserJobSuccess: ['username', 'job'],
updatePermissions: ['permissions'],
updatePermissionsSuccess: ['permissions', 'currentUser'],
getUsersSuggestions: ['searchText'],
getUsersSuggestionsSuccess: ['suggestions'],
clearUsersSuggestions: [],
fetchProject: ['project'],
setProject: ['project'],
updateProjectPermissions: ['permissions'],
updateProjectPermissionsSuccess: ['permissions'],
fetchModelsPermissions: ['models'],
fetchModelPermissionsSuccess: ['selectedModels'],
updateModelsPermissions: ['modelsWithPermissions', 'permissions'],
updateModelsPermissionsPre: ['modelsWithPermissions', 'permissions'],
updateModelPermissionsSuccess: ['updatedModels', 'permissions']
}, { prefix: 'USER_MANAGEMENT/' });
export const INITIAL_STATE = {
示例4: createActions
*/
import { createActions, createReducer } from 'reduxsauce';
import { cloneDeep, keyBy } from 'lodash';
export const { Types: ViewpointsTypes, Creators: ViewpointsActions } = createActions({
setPendingState: ['pendingState'],
fetchViewpoints: ['teamspace', 'modelId'],
fetchViewpointsSuccess: ['viewpoints'],
createViewpoint: ['teamspace', 'modelId', 'viewpoint'],
createViewpointSuccess: ['viewpoint'],
updateViewpoint: ['teamspace', 'modelId', 'viewpointId', 'newName'],
updateViewpointSuccess: ['viewpoint'],
deleteViewpoint: ['teamspace', 'modelId', 'viewpointId'],
deleteViewpointSuccess: ['viewpointId'],
subscribeOnViewpointChanges: ['teamspace', 'modelId'],
unsubscribeOnViewpointChanges: ['teamspace', 'modelId'],
showViewpoint: ['teamspace', 'modelId', 'view'],
setCameraOnViewpoint: ['teamspace', 'modelId', 'view'],
prepareNewViewpoint: ['teamspace', 'modelId', 'viewpointName'],
setNewViewpoint: ['newViewpoint'],
setActiveViewpoint: ['activeViewpoint'],
setSearchQuery: ['searchQuery'],
showDeleteInfo: ['viewpointId'],
setComponentState: ['componentState']
}, { prefix: 'VIEWPOINTS/' });
export interface IViewpointsComponentState {
activeViewpoint?: number;
editMode?: boolean;
newViewpoint?: any;
示例5: createActions
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
import { isString } from 'lodash';
import { SnackbarProps } from '@material-ui/core/Snackbar';
export const { Types: SnackbarTypes, Creators: SnackbarActions } = createActions({
show: ['config']
}, { prefix: 'SNACKBAR/' });
export const INITIAL_STATE = {
snackConfig: {} as SnackbarProps,
isOpen: false
};
export const show = (state = INITIAL_STATE, action) => {
const parsedConfig = isString(action.config) ? {message: action.config} : action.config;
const config = {
...parsedConfig,
key: (new Date()).valueOf()
};
return { ...state, snackConfig: config, isOpen: true };
};
示例6: createActions
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
export const { Types: GisTypes, Creators: GisActions } = createActions({
initialiseMap: ['params'],
initialiseMapSuccess: ['initialised'],
addSource: ['source'],
addSourceSuccess: ['source'],
removeSource: ['source'],
removeSourceSuccess: ['source'],
resetSources: [],
resetSourcesSuccess: [],
resetMap: []
}, { prefix: 'GIS/' });
export const INITIAL_STATE = {
initialised: false,
visibleSources: []
};
export const initialiseMapSuccess = (state = INITIAL_STATE, { initialised }) => {
return { ...state, initialised };
};
示例7: createActions
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
export const { Types: CurrentUserTypes, Creators: CurrentUserActions } = createActions({
fetchUser: ['username'],
fetchUserSuccess: ['userData'],
fetchQuotaInfo: ['teamspace'],
fetchQuotaInfoSuccess: ['quota'],
fetchUserError: ['error'],
updateUser: ['userData'],
updateUserSuccess: ['userData'],
updateUserPassword: ['passwords'],
setPendingState: ['pendingState'],
setAvatarPendingState: ['pendingState'],
updateButtonText: ['value'],
uploadAvatar: ['file'],
refreshAvatar: ['avatarUrl'],
generateApiKey: [],
deleteApiKey: [],
setAsInitialised: []
}, { prefix: 'CURRENT_USER/' });
export const INITIAL_STATE = {
currentTeamspace: '',
currentUser: {
username: ''
},
isPending: true,
示例8: createActions
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
export const { Types: TreeTypes, Creators: TreeActions } = createActions({
startListenOnSelections: [],
stopListenOnSelections: [],
clearSelectedNodes: [],
getSelectedNodes: [],
getSelectedNodesSuccess: ['selectedNodes'],
showAllNodes: [],
hideSelectedNodes: [],
isolateSelectedNodes: []
}, { prefix: 'TREE/' });
export interface IObjectObjectState {
selectedNodes: any;
}
export const INITIAL_STATE: IObjectObjectState = {
selectedNodes: []
};
export const clearSelectedNodes = (state = INITIAL_STATE, {}) => {
return { ...state, selectedNodes: [] };
示例9: createActions
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
import { sortByField } from '../../helpers/sorting';
export const { Types: ModelTypes, Creators: ModelActions } = createActions({
fetchSettings: ['teamspace', 'modelId'],
fetchSettingsSuccess: ['settings', 'metaKeys'],
updateSettings: ['modelData', 'settings'],
fetchRevisions: ['teamspace', 'modelId'],
fetchRevisionsSuccess: ['revisions'],
downloadModel: ['teamspace', 'modelId'],
uploadModelFile: ['teamspace', 'project', 'modelData', 'fileData'],
setPendingState: ['pendingState'],
onModelStatusChanged: ['modelData', 'teamspace', 'project', 'modelId', 'modelName'],
subscribeOnStatusChange: ['teamspace', 'project', 'modelData'],
unsubscribeOnStatusChange: ['teamspace', 'project', 'modelData'],
fetchMaps: ['teamspace', 'modelId'],
fetchMapsSuccess: ['maps'],
updateSettingsSuccess: ['settings'],
fetchMetaKeys: ['teamspace', 'modelId'],
fetchMetaKeysSuccess: ['metaKeys']
}, { prefix: 'MODEL/' });
export const INITIAL_STATE = {
settings: {properties: {topicTypes: []}},
metaKeys: [],
revisions: [],
isPending: true,
maps: []
示例10: createActions
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createActions, createReducer } from 'reduxsauce';
export const { Types: NotificationsTypes, Creators: NotificationsActions } = createActions({
sendGetNotifications: [],
sendDeleteAllNotifications: [],
confirmSendDeleteAllNotifications: [],
sendUpdateNotificationRead: ['notificationId', 'read'],
sendDeleteNotification: ['notificationId'],
setNotifications: ['notifications'],
upsertNotification: ['notification'],
deleteNotification: ['notification'],
patchNotification: ['notificationPatch'],
patchAllNotifications: ['notificationPatch'],
showUpdatedFailedError: ['errorMessage'],
setDrawerPanelState: ['drawerOpened'],
sendUpdateAllNotificationsRead: ['read']
}, { prefix: 'NOTIFICATIONS/' });
export const INITIAL_STATE = {
notifications: []
};
export const setNotifications = (state = INITIAL_STATE, { notifications }) => {
return {...state, notifications};
};