Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube create request types
export const REQUEST = 'REQUEST';
export const SUCCESS = 'SUCCESS';
export const FAILURE = 'FAILURE';
export function createRequestTypes(base) {
if (!base) {
throw new Error('cannot create request type with base = \'\' or base = null');
return [REQUEST, SUCCESS, FAILURE].reduce((acc, type) => {
acc[type] = `${base}_${type}`;
return acc;
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment