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',
|
|
|
|
'SUBMIT',
|
|
|
|
'REGISTER_SUBMIT',
|
|
|
|
'REGISTER_REQUEST',
|
|
|
|
'REGISTER_SUCCESS',
|
|
|
|
'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-08-17 02:06:22 +00:00
|
|
|
export const ROOMS = createRequestTypes('ROOMS');
|
2017-09-01 19:42:50 +00:00
|
|
|
export const APP = createRequestTypes('APP', ['READY', 'INIT']);
|
2017-08-17 06:28:41 +00:00
|
|
|
export const MESSAGES = createRequestTypes('MESSAGES');
|
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-09-01 19:42:50 +00:00
|
|
|
export const SERVER = createRequestTypes('SERVER', [...defaultTypes, 'SELECT', 'CHANGED', 'ADD']);
|
2017-08-17 16:55:47 +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
|
|
|
|
|
|
|
|
export const INCREMENT = 'INCREMENT';
|
|
|
|
export const DECREMENT = 'DECREMENT';
|