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,
|
|
|
|
'SET_TOKEN',
|
2017-11-13 13:19:24 +00:00
|
|
|
'RESTORE_TOKEN',
|
2017-11-07 16:28:02 +00:00
|
|
|
'SUBMIT',
|
|
|
|
'REGISTER_SUBMIT',
|
|
|
|
'REGISTER_REQUEST',
|
|
|
|
'REGISTER_SUCCESS',
|
2017-11-13 13:35:01 +00:00
|
|
|
'REGISTER_INCOMPLETE',
|
2017-11-07 16:28:02 +00:00
|
|
|
'SET_USERNAME_SUBMIT',
|
|
|
|
'SET_USERNAME_REQUEST',
|
|
|
|
'SET_USERNAME_SUCCESS'
|
|
|
|
]);
|
2017-11-10 13:42:02 +00:00
|
|
|
export const FORGOT_PASSWORD = createRequestTypes('FORGOT_PASSWORD', [
|
|
|
|
...defaultTypes,
|
|
|
|
'INIT'
|
|
|
|
]);
|
2017-12-05 19:57:44 +00:00
|
|
|
export const USER = createRequestTypes('USER', ['SET']);
|
2017-12-08 19:13:21 +00:00
|
|
|
export const ROOMS = createRequestTypes('ROOMS', [...defaultTypes, 'SET_SEARCH']);
|
2018-02-08 14:08:50 +00:00
|
|
|
export const ROOM = createRequestTypes('ROOM', [
|
|
|
|
'ADD_USER_TYPING',
|
|
|
|
'REMOVE_USER_TYPING',
|
|
|
|
'SOMEONE_TYPING',
|
|
|
|
'OPEN',
|
|
|
|
'CLOSE',
|
|
|
|
'USER_TYPING',
|
|
|
|
'MESSAGE_RECEIVED',
|
|
|
|
'SET_LAST_OPEN',
|
|
|
|
'LAYOUT_ANIMATION'
|
|
|
|
]);
|
2017-09-01 19:42:50 +00:00
|
|
|
export const APP = createRequestTypes('APP', ['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
|
|
|
'PERMALINK_REQUEST',
|
|
|
|
'PERMALINK_SUCCESS',
|
|
|
|
'PERMALINK_FAILURE',
|
2017-11-24 20:44:52 +00:00
|
|
|
'PERMALINK_CLEAR',
|
2017-11-21 14:55:50 +00:00
|
|
|
'TOGGLE_PIN_REQUEST',
|
|
|
|
'TOGGLE_PIN_SUCCESS',
|
|
|
|
'TOGGLE_PIN_FAILURE',
|
2017-11-24 20:44:52 +00:00
|
|
|
'SET_INPUT',
|
2018-01-30 19:48:26 +00:00
|
|
|
'CLEAR_INPUT',
|
|
|
|
'TOGGLE_REACTION_PICKER'
|
2017-11-21 14:55:50 +00:00
|
|
|
]);
|
2017-09-25 13:15:28 +00:00
|
|
|
export const CREATE_CHANNEL = createRequestTypes('CREATE_CHANNEL', [
|
|
|
|
...defaultTypes,
|
|
|
|
'REQUEST_USERS',
|
|
|
|
'SUCCESS_USERS',
|
|
|
|
'FAILURE_USERS',
|
|
|
|
'SET_USERS',
|
|
|
|
'ADD_USER',
|
|
|
|
'REMOVE_USER',
|
|
|
|
'RESET'
|
|
|
|
]);
|
2017-08-21 00:11:46 +00:00
|
|
|
export const NAVIGATION = createRequestTypes('NAVIGATION', ['SET']);
|
2017-11-13 13:53:45 +00:00
|
|
|
export const SERVER = createRequestTypes('SERVER', [
|
|
|
|
...defaultTypes,
|
|
|
|
'SELECT',
|
|
|
|
'CHANGED',
|
|
|
|
'ADD',
|
|
|
|
'GOTO_ADD'
|
|
|
|
]);
|
2017-12-20 19:20:06 +00:00
|
|
|
export const METEOR = createRequestTypes('METEOR_CONNECT', [...defaultTypes, 'DISCONNECT', 'DISCONNECT_BY_USER']);
|
2017-08-16 23:29:12 +00:00
|
|
|
export const LOGOUT = 'LOGOUT'; // logout is always success
|
2017-12-08 19:13:21 +00:00
|
|
|
export const ACTIVE_USERS = createRequestTypes('ACTIVE_USERS', ['SET', 'REQUEST']);
|
2017-08-16 23:29:12 +00:00
|
|
|
|
|
|
|
export const INCREMENT = 'INCREMENT';
|
|
|
|
export const DECREMENT = 'DECREMENT';
|
2018-02-08 14:08:50 +00:00
|
|
|
|