diff options
Diffstat (limited to 'web/react/stores/modal_store.jsx')
-rw-r--r-- | web/react/stores/modal_store.jsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/web/react/stores/modal_store.jsx b/web/react/stores/modal_store.jsx index dc65d48da..9f33cf022 100644 --- a/web/react/stores/modal_store.jsx +++ b/web/react/stores/modal_store.jsx @@ -1,10 +1,10 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -const AppDispatcher = require('../dispatcher/app_dispatcher.jsx'); -const EventEmitter = require('events').EventEmitter; +import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; +import EventEmitter from 'events'; -const Constants = require('../utils/constants.jsx'); +import Constants from '../utils/constants.jsx'; const ActionTypes = Constants.ActionTypes; class ModalStoreClass extends EventEmitter { @@ -27,12 +27,16 @@ class ModalStoreClass extends EventEmitter { } handleEventPayload(payload) { - const action = payload.action; + // toggle event handlers should accept a boolean show/hide value and can accept a map of arguments + const {type, value, ...args} = payload.action; //eslint-disable-line no-redeclare - switch (action.type) { + switch (type) { case ActionTypes.TOGGLE_IMPORT_THEME_MODAL: case ActionTypes.TOGGLE_INVITE_MEMBER_MODAL: - this.emit(action.type, action.value); + case ActionTypes.TOGGLE_DELETE_POST_MODAL: + case ActionTypes.TOGGLE_GET_TEAM_INVITE_LINK_MODAL: + case ActionTypes.TOGGLE_REGISTER_APP_MODAL: + this.emit(type, value, args); break; } } |