redux-actions#createActions JavaScript Examples

The following examples show how to use redux-actions#createActions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{ loadingChats, failedLoadedChats, initChats, sendMessage, addChat, fire, unfire } = createActions({
    LOADING_CHATS: () => ({}),
    FAILED_LOADED_CHATS: (error) => ({ error }),
    INIT_CHATS: (chats) => ({ chats }),
    SEND_MESSAGE: (id, name, content) => ({ id, name, content }),
    // CREATE_CHAT: (name) => ({name}),
    ADD_CHAT: (id, name, botId) => ({ id, name, botId }),
    FIRE: (id) => ({ id }),
    UNFIRE: (id) => ({ id }),
})
Example #2
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{
  chatsRequest,
  chatsSuccess,
  chatsFailure,
  addMessage,
  deleteMessage,
  addChat,
  deleteChat,
  highlightChat
} = createActions({
  CHATS_REQUEST: () => ({}),
  CHATS_SUCCESS: data => data,
  CHATS_FAILURE: error => error,
  ADD_MESSAGE: (chatId, messageId, name, content) => ({
    chatId,
    messageId,
    name,
    content
  }),
  DELETE_MESSAGE: (chatId, messageId) => ({ chatId, messageId }),
  ADD_CHAT: (title, chatId) => ({ title, chatId }),
  DELETE_CHAT: chatId => ({ chatId }),
  HIGHLIGHT_CHAT: chatId => ({ chatId })
})
Example #3
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{addChat, addMessage, fire, unfire, chatsRequest, chatsSuccess, chatsFailure} = createActions({
    // LOAD_CHATS: () => ({}), loadChats
    ADD_CHAT: (name) => ({name}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (err) => (err),
})
Example #4
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{ addMessage, addChat, deleteChat, addUnread, deleteUnread, chatsRequest, chatsSuccess, chatsFailure } = createActions({
    //LOAD_CHATS: () => ({}), loadChats,
    ADD_MESSAGE: (id, name, content) => ({ id, name, content }),
    ADD_CHAT: (id, name) => ({ id, name }),
    DELETE_CHAT: (id, name) => ({ id, name }),
    DELETE_MESSAGE: (id, name, content) => ({ id, name, content }),
    ADD_UNREAD: (id) => ({ id }),
    DELETE_UNREAD: (id) => ({ id }),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (error) => (error),
})
Example #5
Source File: chatActions.js    From react-14.01 with MIT License 6 votes vote down vote up
{ addMessage, chatStatus } = createActions({
    // LOAD_CHATS: () => ({
    //     chats: {
    //         1: {
    //             name: 'Chat 1',
    //             messages: [
    //                 {name: "Ivan", content: "Hello! It's chat one!"},
    //                 {name: "Ivan", content: "How are you?"},
    //             ]
    //         },
    //         2: {
    //             name: 'Chat 2',
    //             messages: [
    //                 {name: "Den", content: "Hi from chat 2"},
    //             ]
    //         },
    //         3: {
    //             name: 'Chat 3',
    //             messages: []
    //         }
    //     },
    // }),
    ADD_MESSAGE: (id, name, content) => ({ id, name, content }),
    CHAT_STATUS: (id, is_active) => ({ id, is_active }),
})
Example #6
Source File: messageActions.js    From react-03.03 with MIT License 6 votes vote down vote up
actions = createActions({
    '@@messages': {
        LOADING_MESSAGES: () => ({}),
        FAILED_LOADED_MESSAGES: () =>({}),
        INIT_MESSAGES: () =>({}),
        SEND_MESSAGE: (chatId, senderId, content) => ({
            chatId,
            senderId,
            content,
        })
    }
})
Example #7
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{chats:{
    loadingChats,
    failedLoadedChats,
    initChats,
    addChat,
    removeChat,
    startFire,
    finishFire
}} = createActions({
    CHATS: {
        LOADING_CHATS: () => ({}),
        FAILED_LOADED_CHATS: (error) => ({error}),
        INIT_CHATS: (chats) => ({chats}),
        ADD_CHAT: (title) => ({title}),
        START_FIRE: (chatId) => ({chatId}),
        FINISH_FIRE: (chatId) => ({chatId}),
        REMOVE_CHAT: (chatId) => ({chatId}),
    },
})
Example #8
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{ loadChats, addMessage } = createActions({
    LOAD_CHATS: () => ({}),// эмитация бэка типа что то с него "LOAD"
    /**
     * Action - экшен передает аргументы функции в обьект.Добавляет новый чат
     * @param id сообщения
     * @param name отправителя сообщения
     * @param content содержание сообщения
     */
    ADD_MESSAGE: (id, name, content) => (
        {
            id,// пример: совпадения параметра со значением id: id . пишется просто id 
            name,
            content
        }
    ),
})
Example #9
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{addMessage, addChat, fire, unfire, chatsRequest, chatsSuccess, chatsFailure} = createActions ({
    //LOAD_CHATS: () => ({}),   loadChats, 
    ADD_CHAT: (name) => ({name}),
    ADD_MESSAGE: (id, text, content) => ({id, text, content}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (error) => (error)
})
Example #10
Source File: app.js    From full-stack-fastapi-react-postgres-boilerplate with MIT License 6 votes vote down vote up
{ hideAlert, showAlert, switchMenu } = createActions({
  [ActionTypes.SWITCH_MENU]: (query: string) => ({ query }),
  [ActionTypes.HIDE_ALERT]: (id: string) => ({ id }),
  [ActionTypes.SHOW_ALERT]: (message: string, options: Object) => {
    const timeout = options.variant === 'danger' ? 0 : 5;

    return {
      id: options.id || uid(),
      icon: options.icon,
      message,
      position: options.position || 'bottom-right',
      variant: options.variant || 'dark',
      timeout: typeof options.timeout === 'number' ? options.timeout : timeout,
    };
  },
})
Example #11
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{loadingChats, failedLoadedChats, initChats, sendMessage, addChat, fire, unfire} = createActions({
    LOADING_CHATS: () => ({}),
    FAILED_LOADED_CHATS: (error) => ({error}),
    INIT_CHATS: (chats) => ({chats}),
    SEND_MESSAGE: (id, name, content) => ({id, name, content}),
    // CREATE_CHAT: (name) => ({name}),
    ADD_CHAT: (id, name, botId) => ({id, name, botId}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
})
Example #12
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{ addChat, addMessage, fire, unfire, chatsRequest, chatsSuccess, chatsFailure} = createActions({
    // LOAD_CHATS: () => ({}), loadChats,
    ADD_CHAT: (name) => ({name}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (error) => (error),
})
Example #13
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{ initChats, sendMessage, addChat, updateProfile, selectChat, fireChat, unfireChat } = createActions({
    INIT_CHATS: () => ({}),
    SEND_MESSAGE: (id, user, text) => ({id, user, text}),
    ADD_CHAT: (name) => ({name}),
    UPDATE_PROFILE: (profile) => ({profile}),
    SELECT_CHAT: (id) => ({id}),
    FIRE_CHAT: (id) => ({id}),
    UNFIRE_CHAT: (id) => ({id}),
})
Example #14
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{fire, unfire, loadingChats, failedLoadedChats, initChats, sendMessage, addChat} = createActions({
  LOADING_CHATS: () => ({}),
  FAILED_LOADED_CHATS: (error) => ({error}),
  INIT_CHATS: (chats) => ({chats}),
  SEND_MESSAGE: (id, name, content) => ({id, name, content}),
  // CREATE_CHAT: (name) => ({name}),
  ADD_CHAT: (id, name, botId) => ({id, name, botId}),
  FIRE: (id) => ({id}),
  UNFIRE: (id) => ({id}),
})
Example #15
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{loadingChats, failedLoadedChats, initChats, sendMessage, addChat, fire, unfire} = createActions({
    LOADING_CHATS: () => ({}),
    FAILED_LOADED_CHATS: (error) => ({error}),
    INIT_CHATS: (chats) => ({chats}),
    SEND_MESSAGE: (id, name, content) => ({id, name, content}),
    ADD_CHAT: (id, name, botId) => ({id, name, botId}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
})
Example #16
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{ addChat, addMessage, fire, unfire, chatsRequest, chatsSuccess, chatsFailure} = createActions({
    // LOAD_CHATS: () => ({}), loadChats,
    ADD_CHAT: (name) => ({name}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (error) => (error),
})
Example #17
Source File: index.js    From stayaway-app with European Union Public License 1.2 6 votes vote down vote up
creators = createActions(
  types.SET_SIGN_UP_DATE,
  types.SET_TRACING_ENABLED,
  types.SET_STATUS,
  types.SET_ERRORS,
  types.SET_INFECTION_STATUS,
  types.SET_LANGUAGE,
  types.SET_THEME,
  types.ENABLE_EXPOSURE_NOTIFICATIONS,
  types.UPDATE_STATUS,
  types.UPDATE_STATUS_RESULT,
  types.UPDATE_LANGUAGE,
  types.SETUP_NEW_ACCOUNT_REQUEST,
  types.SETUP_NEW_ACCOUNT_PENDING,
  types.SETUP_NEW_ACCOUNT_DONE,
  types.START_TRACING,
  types.START_TRACING_RESULT,
  types.STOP_TRACING,
  types.STOP_TRACING_RESULT,
  types.SUBMIT_DIAGNOSIS_REQUEST,
  types.SUBMIT_DIAGNOSIS_PENDING,
  types.SUBMIT_DIAGNOSIS_ERROR,
  types.SUBMIT_DIAGNOSIS_DONE,
  types.SWITCH_TRACING,
  types.TRACING_STATUS_LISTENER_REGISTERED,
  types.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
)
Example #18
Source File: index.js    From stayaway-app with European Union Public License 1.2 6 votes vote down vote up
creators = createActions(
  types.OPEN_NETWORK_MODAL,
  types.NETWORK_MODAL_OPEN,
  types.CLOSE_NETWORK_MODAL,
  types.NETWORK_MODAL_CLOSED,
  types.OPEN_SERVER_ERROR_MODAL,
  types.SERVER_ERROR_MODAL_OPEN,
  types.CLOSE_SERVER_ERROR_MODAL,
  types.SERVER_ERROR_MODAL_CLOSED,
  types.OPEN_TOO_MUCH_REQUESTS_MODAL,
  types.TOO_MUCH_REQUESTS_MODAL_OPEN,
  types.CLOSE_TOO_MUCH_REQUESTS_MODAL,
  types.TOO_MUCH_REQUESTS_MODAL_CLOSED,
  types.OPEN_INVALID_CODE_MODAL,
  types.INVALID_CODE_MODAL_OPEN,
  types.CLOSE_INVALID_CODE_MODAL,
  types.INVALID_CODE_MODAL_CLOSED,
  types.OPEN_EXPIRED_CODE_MODAL,
  types.EXPIRED_CODE_MODAL_OPEN,
  types.CLOSE_EXPIRED_CODE_MODAL,
  types.EXPIRED_CODE_MODAL_CLOSED,
  types.OPEN_LOADING_MODAL,
  types.LOADING_MODAL_OPEN,
  types.CLOSE_LOADING_MODAL,
  types.LOADING_MODAL_CLOSED,
  types.OPEN_PROTECTOR_MODAL,
  types.PROTECTOR_MODAL_OPEN,
  types.CLOSE_PROTECTOR_MODAL,
  types.PROTECTOR_MODAL_CLOSED,
  types.OPEN_CONTACT_MODAL,
  types.CONTACT_MODAL_OPEN,
  types.CLOSE_CONTACT_MODAL,
  types.CONTACT_MODAL_CLOSED,
)
Example #19
Source File: chatAction.js    From react-14.01 with MIT License 6 votes vote down vote up
{addMessage, addChat, switchToAdd, changeClass, switchPage, setIsActive, deleteChat, deleteMessage, chatsRequest, chatsSuccess, chatsFailure} = createActions({
    //LOAD_CHATS: () => ({}),
    ADD_MESSAGE: (id, msgClass, name, message, time) => ({id, msgClass, name, message, time}),
    ADD_CHAT: (name, messages, userAvatar) => ({name, messages, userAvatar}),
    SWITCH_TO_ADD: () => ({}),
    CHANGE_CLASS: (id, newClassName) =>({id, newClassName}),
    SWITCH_PAGE: (id, linkStr) => ({id, linkStr}),
    SET_IS_ACTIVE: (id, isActiveClass, botAnswersClass) => ({id, isActiveClass, botAnswersClass}),
    DELETE_CHAT: (id) => ({id}),
    DELETE_MESSAGE: (id, msgIdx) => ({id, msgIdx}),
    CHATS_REQUEST: () => ({}),
    CHATS_SUCCESS: (data) => (data),
    CHATS_FAILURE: (error) => ({error}),
})
Example #20
Source File: chatActions.js    From react-03.03 with MIT License 6 votes vote down vote up
{initChats, sendMessage, addChat, loadingChats, failedLoadedChats, fire, unfire, initProfile, loadingProfile, failedLoadedProfile} = createActions({
    INIT_CHATS: (chats) => ({chats}),
	LOADING_CHATS: () => ({}),
    SEND_MESSAGE: (id, name, text) => ({id, name, text}),
	ADD_CHAT: (id, name, botId) => ({id, name, botId}),
	FAILED_LOADED_CHATS: (error) => ({error}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
	INIT_PROFILE: (user) => ({user}),
	LOADING_PROFILE: () => ({}),
	FAILED_LOADED_PROFILE: (error) => ({error})
})
Example #21
Source File: index.js    From stayaway-app with European Union Public License 1.2 6 votes vote down vote up
creators = createActions(
  types.CHECK_PERMISSION,
  types.CHECK_ALL_PERMISSIONS,
  types.CHECK_ALL_PERMISSIONS_RESULT,
  types.REQUEST_PERMISSION,
  types.REQUEST_ALL_PERMISSIONS,
  types.REQUEST_ALL_PERMISSIONS_RESULT,
  types.PERMISSION_GRANTED,
  types.PERMISSION_DENIED,
  types.ALL_PERMISSIONS_GRANTED,
)
Example #22
Source File: chatActions.js    From react-14.01 with MIT License 6 votes vote down vote up
{ addChat, addMessage, fire, unfire, chatRequest, chatSuccess, chatFailure } = createActions({
	ADD_CHAT: (name) => ({ name }),
	ADD_MESSAGE: (id, name, text) => ({ id, name, text }),
	FIRE: (id) => ({ id }),
	UNFIRE: (id) => ({ id }),
	CHAT_REQUEST: () => ({}),
	CHAT_SUCCESS: data => data,
	CHAT_FAILURE: error => error
})
Example #23
Source File: chatAction.js    From react-14.01 with MIT License 5 votes vote down vote up
{loadChats, addChat, addMessage} = createActions({
    LOAD_CHATS: () => ({}),
    ADD_CHAT: (name) => ({name}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
})
Example #24
Source File: profileActions.js    From react-14.01 with MIT License 5 votes vote down vote up
{ editProfile, profilesRequest, profilesSuccess, profilesFailure } = createActions({
    EDIT_PROFILE: (name) => ({ name }),
    PROFILES_REQUEST: () => ({}),
    PROFILES_SUCCESS: data => data,
    PROFILES_FAILURE: error => error,
})
Example #25
Source File: chatAction.js    From react-14.01 with MIT License 5 votes vote down vote up
{addChat, addMessage, fire, unfire} = createActions({
    /*LOAD_CHATS: () => ({}),*/
    ADD_CHAT: (name, id) => ({name, id}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
    fire: (id) => ({id}),
    unfire: (id) => ({id}),
})
Example #26
Source File: chatAction.js    From react-14.01 with MIT License 5 votes vote down vote up
{loadChats, addChat, addMessage, fire, unfire} = createActions ({
    LOAD_CHATS: () => ({}),
    ADD_CHAT: (id, name) => ({id, name}),
    ADD_MESSAGE: (id, name, content) => ({id, name, content}),
    FIRE: (id) => ({id}),
    UNFIRE: (id) => ({id}),
})
Example #27
Source File: userAction.js    From react-14.01 with MIT License 5 votes vote down vote up
{ userRequest, userSuccess, userFailure } = createActions({
  USER_REQUEST: () => ({}),
  USER_SUCCESS: data => data,
  USER_FAILURE: error => error
})
Example #28
Source File: github.js    From full-stack-fastapi-react-postgres-boilerplate with MIT License 5 votes vote down vote up
{ githubGetRepos: getRepos } = createActions({
  [ActionTypes.GITHUB_GET_REPOS]: (query: string) => ({ query }),
})
Example #29
Source File: user.js    From full-stack-fastapi-react-postgres-boilerplate with MIT License 5 votes vote down vote up
{ userLogin: login, userLogout: logOut } = createActions({
  [ActionTypes.USER_LOGIN]: () => ({}),
  [ActionTypes.USER_LOGOUT]: () => ({}),
})