2017-08-16 23:29:12 +00:00
|
|
|
const REQUEST = 'REQUEST';
|
|
|
|
const SUCCESS = 'SUCCESS';
|
|
|
|
const FAILURE = 'FAILURE';
|
2017-08-17 01:06:31 +00:00
|
|
|
const defaultTypes = [REQUEST, SUCCESS, FAILURE];
|
|
|
|
function createRequestTypes(base, types = defaultTypes) {
|
2017-08-16 23:29:12 +00:00
|
|
|
const res = {};
|
2017-09-25 13:15:28 +00:00
|
|
|
types.forEach(type => (res[type] = `${ base }_${ type }`));
|
2017-08-16 23:29:12 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Login events
|
2017-11-07 16:28:02 +00:00
|
|
|
export const LOGIN = createRequestTypes('LOGIN', [
|
|
|
|
...defaultTypes,
|
2018-02-23 20:29:06 +00:00
|
|
|
'SET_SERVICES',
|
2018-09-04 14:29:20 +00:00
|
|
|
'SET_PREFERENCE',
|
|
|
|
'SET_SORT_PREFERENCE'
|
2017-11-07 16:28:02 +00:00
|
|
|
]);
|
2017-12-05 19:57:44 +00:00
|
|
|
export const USER = createRequestTypes('USER', ['SET']);
|
2018-08-31 16:46:33 +00:00
|
|
|
export const ROOMS = createRequestTypes('ROOMS', [
|
|
|
|
...defaultTypes,
|
|
|
|
'SET_SEARCH',
|
|
|
|
'CLOSE_SERVER_DROPDOWN',
|
|
|
|
'TOGGLE_SERVER_DROPDOWN',
|
|
|
|
'CLOSE_SORT_DROPDOWN',
|
2018-10-23 21:39:48 +00:00
|
|
|
'TOGGLE_SORT_DROPDOWN',
|
|
|
|
'OPEN_SEARCH_HEADER',
|
|
|
|
'CLOSE_SEARCH_HEADER'
|
2018-08-31 16:46:33 +00:00
|
|
|
]);
|
2018-02-08 14:08:50 +00:00
|
|
|
export const ROOM = createRequestTypes('ROOM', [
|
|
|
|
'ADD_USER_TYPING',
|
|
|
|
'REMOVE_USER_TYPING',
|
|
|
|
'SOMEONE_TYPING',
|
|
|
|
'OPEN',
|
|
|
|
'CLOSE',
|
2018-03-23 16:49:51 +00:00
|
|
|
'LEAVE',
|
2018-03-29 17:55:37 +00:00
|
|
|
'ERASE',
|
2018-02-08 14:08:50 +00:00
|
|
|
'USER_TYPING',
|
|
|
|
'MESSAGE_RECEIVED',
|
2018-05-18 17:55:08 +00:00
|
|
|
'SET_LAST_OPEN'
|
2018-02-08 14:08:50 +00:00
|
|
|
]);
|
2019-03-12 16:23:06 +00:00
|
|
|
export const APP = createRequestTypes('APP', ['START', 'READY', 'INIT']);
|
2017-11-21 14:55:50 +00:00
|
|
|
export const MESSAGES = createRequestTypes('MESSAGES', [
|
|
|
|
...defaultTypes,
|
2017-11-24 20:44:52 +00:00
|
|
|
'ACTIONS_SHOW',
|
|
|
|
'ACTIONS_HIDE',
|
2017-12-13 15:00:26 +00:00
|
|
|
'ERROR_ACTIONS_SHOW',
|
|
|
|
'ERROR_ACTIONS_HIDE',
|
2017-11-21 14:55:50 +00:00
|
|
|
'DELETE_REQUEST',
|
|
|
|
'DELETE_SUCCESS',
|
|
|
|
'DELETE_FAILURE',
|
|
|
|
'EDIT_INIT',
|
2017-11-24 20:44:52 +00:00
|
|
|
'EDIT_CANCEL',
|
2017-11-21 14:55:50 +00:00
|
|
|
'EDIT_REQUEST',
|
|
|
|
'EDIT_SUCCESS',
|
|
|
|
'EDIT_FAILURE',
|
2017-11-24 20:44:52 +00:00
|
|
|
'TOGGLE_STAR_REQUEST',
|
|
|
|
'TOGGLE_STAR_SUCCESS',
|
|
|
|
'TOGGLE_STAR_FAILURE',
|
2017-11-21 14:55:50 +00:00
|
|
|
'TOGGLE_PIN_REQUEST',
|
|
|
|
'TOGGLE_PIN_SUCCESS',
|
|
|
|
'TOGGLE_PIN_FAILURE',
|
2018-07-20 19:54:46 +00:00
|
|
|
'REPLY_INIT',
|
|
|
|
'REPLY_CANCEL',
|
2018-05-24 20:17:45 +00:00
|
|
|
'TOGGLE_REACTION_PICKER',
|
|
|
|
'REPLY_BROADCAST'
|
2017-11-21 14:55:50 +00:00
|
|
|
]);
|
2018-04-24 19:34:03 +00:00
|
|
|
export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [...defaultTypes]);
|
|
|
|
export const SELECTED_USERS = createRequestTypes('SELECTED_USERS', ['ADD_USER', 'REMOVE_USER', 'RESET', 'SET_LOADING']);
|
2017-11-13 13:53:45 +00:00
|
|
|
export const SERVER = createRequestTypes('SERVER', [
|
|
|
|
...defaultTypes,
|
2018-08-01 19:35:06 +00:00
|
|
|
'SELECT_SUCCESS',
|
2018-08-31 18:13:30 +00:00
|
|
|
'SELECT_REQUEST',
|
|
|
|
'INIT_ADD',
|
|
|
|
'FINISH_ADD'
|
2017-11-13 13:53:45 +00:00
|
|
|
]);
|
2018-12-05 20:52:08 +00:00
|
|
|
export const METEOR = createRequestTypes('METEOR_CONNECT', [...defaultTypes, 'DISCONNECT']);
|
2017-08-16 23:29:12 +00:00
|
|
|
export const LOGOUT = 'LOGOUT'; // logout is always success
|
2018-03-29 17:55:37 +00:00
|
|
|
export const ACTIVE_USERS = createRequestTypes('ACTIVE_USERS', ['SET']);
|
|
|
|
export const ROLES = createRequestTypes('ROLES', ['SET']);
|
2018-04-24 19:34:03 +00:00
|
|
|
export const SNIPPETED_MESSAGES = createRequestTypes('SNIPPETED_MESSAGES', ['OPEN', 'READY', 'CLOSE', 'MESSAGES_RECEIVED']);
|
2018-05-07 20:43:26 +00:00
|
|
|
export const DEEP_LINKING = createRequestTypes('DEEP_LINKING', ['OPEN']);
|
2018-09-04 14:29:20 +00:00
|
|
|
export const SORT_PREFERENCES = createRequestTypes('SORT_PREFERENCES', ['SET_ALL', 'SET']);
|