Skip to content

Instantly share code, notes, and snippets.

@RayLuxembourg
Created January 19, 2017 11:39
Show Gist options
  • Save RayLuxembourg/a5f3bef460732a0483d9a42fba1ab834 to your computer and use it in GitHub Desktop.
Save RayLuxembourg/a5f3bef460732a0483d9a42fba1ab834 to your computer and use it in GitHub Desktop.
CRUD CONST CREATOR
const Actions = (type) => ({
FETCH: {
IN_PROGRESS: `FETCH_${type}_IN_PROGRESS`,
SUCCESS: `FETCH_${type}_SUCCESS`,
ERROR: `FETCH_${type}_ERROR`
},
POST: {
IN_PROGRESS: `POST${type}_IN_PROGRESS`,
SUCCESS: `POST${type}_SUCCESS`,
ERROR: `POST${type}_ERROR`
},
UPDATE: {
IN_PROGRESS: `UPDATE${type}_IN_PROGRESS`,
SUCCESS: `UPDATE${type}_SUCCESS`,
ERROR: `UPDATE${type}_ERROR`
},
DELETE: {
IN_PROGRESS: `DELETE${type}_IN_PROGRESS`,
SUCCESS: `DELETE${type}_SUCCESS`,
ERROR: `DELETE${type}_ERROR`
}
})
// FETCH SINGLE
export const CONFIGURATIONS = Actions("CONFIGURATIONS");
export const EMPLOYERS = Actions("EMPLOYERS");
export const REPORTS = Actions("REPORTS");
export const PENSIONS = Actions("PENSIONS");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment