How to use the typesafe-actions.createAction function in typesafe-actions

To help you get started, we’ve selected a few typesafe-actions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hectim / parcel-react-app / src / graph / actions.ts View on Github external
import { createAction } from 'typesafe-actions';
import { GraphNode, Label, UpdateLabel, UpdateGraphNode } from './types';

// Add Node
export const requestAddNode = createAction('GRAPH_REQUEST_ADD_NODE');
export const successAddNode = createAction('GRAPH_ADD_NODE', (node: GraphNode) => ({
  type: 'GRAPH_ADD_NODE',
  payload: node,
}));
export const failureAddNode = createAction('GRAPH_FAILURE_ADD_NODE', (error: string) => ({
  type: 'GRAPH_FAILURE_ADD_NODE',
  payload: error,
}));

export const requestRemoveNode = createAction('GRAPH_REQUEST_REMOVE_NODE', (node: GraphNode) => ({
  type: 'GRAPH_REQUEST_REMOVE_NODE',
  payload: node
}));
export const successRemoveNode = createAction('GRAPH_REMOVE_NODE', (node: GraphNode) => ({
  type: 'GRAPH_REMOVE_NODE',
  payload: node,
}));
export const failureRemoveNode = createAction('GRAPH_FAILURE_REMOVE_NODE', (error: string) => ({
  type: 'GRAPH_FAILURE_REMOVE_NODE',
  payload: error,
}));
github textileio / photos / App / Redux / PreferencesRedux.ts View on Github external
import { RootState } from './Types'

const actions = {
  onboardingSuccess: createAction('ONBOARDING_SUCCESS', resolve => {
    return () => resolve()
  }),
  toggleVerboseUi: createAction('TOGGLE_VERBOSE_UI', resolve => {
    return () => resolve()
  }),
  completeTourSuccess: createAction('COMPLETE_TOUR_SUCCESS', resolve => {
    return (tourKey: TourScreens) => resolve({ tourKey })
  }),
  toggleServicesRequest: createAction('TOGGLE_SERVICES_REQUEST', resolve => {
    return (name: ServiceType, status?: boolean) => resolve({ name, status })
  }),
  toggleStorageRequest: createAction('TOGGLE_STORAGE_REQUEST', resolve => {
    return (name: StorageType, status?: boolean) => resolve({ name, status })
  }),
  updateViewSetting: createAction('TOGGLE_VIEW_SETTING', resolve => {
    return (name: string, value: string) => resolve({ name, value })
  }),
  // Verbose UI options
  toggleNodeStateNotifications: createAction(
    'TOGGLE_NODE_STATE_NOTIFICATIONS',
    resolve => {
      return () => resolve()
    }
  ),
  toggleNodeStateOverlay: createAction('TOGGLE_NODE_STATE_OVERLAY', resolve => {
    return () => resolve()
  }),
  toggleNodeErrorNotifications: createAction(
github nowyasimi / no8am / no8am / static / js / calendar / CalendarActions.ts View on Github external
import {createAction} from "typesafe-actions";

export const mouseEnterCalendarSection = createAction("MOUSE_ENTER_CALENDAR_SECTION", (resolve) =>
    (CRN: string) => resolve({CRN}));

export const mouseLeaveCalendarSection = createAction("MOUSE_LEAVE_CALENDAR_SECTION");
github textileio / photos / App / features / group / add-photo / actions.ts View on Github external
})

export const cleanupComplete = createAction(
  'addPhoto/CLEANUP_COMPLETE',
  resolve => {
    return (uuid: string) => resolve({ uuid })
  }
)

export const error = createAction('addPhoto/ERROR', resolve => {
  return (uuid: string, error: any) => resolve({ uuid, error })
})

export const cancelFailedAdds = createAction('addPhoto/CANCEL_FAILED_ADDS')

export const retryFailedAdds = createAction('addPhoto/RETRY_FAILED_ADDS')
github textileio / photos / App / Redux / UIRedux.ts View on Github external
updateSharingPhotoComment: createAction(
    'UPDATE_SHARING_PHOTO_COMMENT',
    resolve => {
      return (comment: string) => resolve({ comment })
    }
  ),
  initShareRequest: createAction('INIT_SHARE_PHOTO_REQUEST', resolve => {
    return (threadId: string, comment?: string) =>
      resolve({ threadId, comment })
  }),
  sharePhotoRequest: createAction('SHARE_PHOTO_REQUEST', resolve => {
    return (image: string, threadId: string, comment?: string) =>
      resolve({ image, threadId, comment })
  }),
  cancelSharingPhoto: createAction('CANCEL_SHARING_PHOTO'),
  cleanupComplete: createAction('CLEANUP_COMPLETE'),
  imageSharingError: createAction('IMAGE_SHARING_ERROR', resolve => {
    return (error: Error) => resolve(error)
  }),
  shareByLink: createAction('SHARE_BY_LINK', resolve => {
    return (path: string) => resolve({ path })
  }),
  showImagePicker: createAction('SHOW_IMAGE_PICKER', resolve => {
    return (pickerType?: string) => resolve({ pickerType })
  }),
  showWalletPicker: createAction('SHOW_WALLET_PICKER', resolve => {
    return (threadId?: string) => resolve({ threadId })
  }),
  walletPickerSuccess: createAction('WALLET_PICKER_SUCCESS', resolve => {
    return (photo: IFiles) => resolve({ photo })
  }),
  newImagePickerSelection: createAction(
github OfficeDev / script-lab / packages / editor / src / pages / Editor / store / editor / actions.ts View on Github external
'EDITOR_SET_INTELLISENSE_FILES_FAILURE',
)<{ urls: string[] }, { [url: string]: monaco.IDisposable }, Error>();

export const removeIntellisenseFiles = createAction(
  'EDITOR_REMOVE_INTELLISENSE_FILES',
  resolve => {
    return (urls: string[]) => resolve(urls);
  },
);

export const applyFormatting = createAction('APPLY_FORMATTING');

export const newSolutionOpened = createAction('NEW_SOLUTION_OPENED', resolve => {
  return (solution: ISolution) => resolve(solution);
});
export const newFileOpened = createAction('NEW_FILE_OPENED', resolve => {
  return (solution: ISolution, file: IFile) => resolve({ solution, file });
});

export const navigateToRun = createAction('NAVIGATE_TO_RUN');

export const shouldUpdateIntellisense = createAction('EDITOR_SHOULD_UPDATE_INTELLISENSE');
github textileio / photos / App / Redux / CameraRollRedux.ts View on Github external
import { createAction, ActionType, getType } from 'typesafe-actions'
import { RootState } from './Types'

const actions = {
  initialzePhotos: createAction('INITIALIZE_PHOTOS', resolve => {
    return (ids: string[]) => resolve({ ids })
  }),
  updateQuerying: createAction('UPDATE_QUERYING', resolve => {
    return (querying: boolean) => resolve({ querying })
  }),
  trackPhoto: createAction('TRACK_PHOTO', resolve => {
    return (id: string) => resolve({ id })
  }),
  trackPhotos: createAction('TRACK_PHOTOS', resolve => {
    return (ids: string[]) => resolve({ ids })
  }),
  untrackPhoto: createAction('UNTRACK_PHOTO', resolve => {
    return (id: string) => resolve({ id })
  }),
  untrackPhotos: createAction('UNTRACK_PHOTOS', resolve => {
    return (ids: string[]) => resolve({ ids })
  })
}

export type CameraRollAction = ActionType

export interface QueriedPhotosMap {
github foray1010 / Popup-my-Bookmarks / src / popup / reduxs / bookmark / actions.ts View on Github external
isCloseThisExtension: boolean
    },
  ) => ({
    id,
    openBookmarkProps,
  }),
)()

export const pasteBookmark = createAction(
  'PASTE_BOOKMARK',
  (parentId: string, index: number) => ({ parentId, index }),
)()

export const refreshBookmarkTrees = createAction('REFRESH_BOOKMARK_TREES')()

export const removeBookmarkTree = createAction(
  'REMOVE_BOOKMARK_TREE',
  (id: string) => ({
    id,
  }),
)()

export const removeDragIndicator = createAction('REMOVE_DRAG_INDICATOR')()

export const removeNextBookmarkTrees = createAction(
  'REMOVE_NEXT_BOOKMARK_TREES',
  (removeAfterId: string) => ({ removeAfterId }),
)()

export const resetClipboard = createAction('RESET_CLIPBOARD')()

export const setBookmarkTrees = createAction(
github OfficeDev / script-lab / client / src / store / customFunctions / actions.ts View on Github external
code: string
}

export const fetchMetadata = createAsyncAction(
  'CUSTOM_FUNCTIONS_FETCH_METADATA_REQUEST',
  'CUSTOM_FUNCTIONS_FETCH_METADATA_SUCCESS',
  'CUSTOM_FUNCTIONS_FETCH_METADATA_FAILURE',
)()

export const registerMetadata = createAsyncAction(
  'REGISTER_METADATA_REQUEST_CUSTOM_FUNCTIONS',
  'CUSTOM_FUNCTIONS_REGISTER_METADATA_SUCCESS',
  'CUSTOM_FUNCTIONS_REGISTER_METADATA_FAILURE',
)()

export const pushLogs = createAction('CUSTOM_FUNCTIONS_PUSH_LOGS', resolve => {
  return (logs: ILogData[]) => resolve(logs)
})

export const updateRunner = createAction('CUSTOM_FUNCTIONS_UPDATE_RUNNER', resolve => {
  return (props: IRunnerState) => resolve(props)
})

export const updateEngineStatus = createAction(
  'CUSTOM_FUNCTIONS_UPDATE_ENGINE_STATUS',
  resolve => {
    return (props: ICustomFunctionEngineStatus) => resolve(props)
  },
)

export const clearLogs = createAction('CUSTOM_FUNCTIONS_CLEAR_LOGS')