contentType.js 683B

123456789101112131415161718192021222324252627
  1. import { CONTENT_TYPE_LIST } from '../action-creator.sync.js'
  2. export function contentType (state = [], action) {
  3. switch (action.type) {
  4. case `Set/${CONTENT_TYPE_LIST}`:
  5. return action.contentTypeList.map(ct => ({
  6. label: ct.label,
  7. slug: ct.slug,
  8. faIcon: ct.fa_icon,
  9. hexcolor: ct.hexcolor,
  10. creationLabel: ct.creation_label,
  11. availableStatuses: ct.available_statuses.map(as => ({
  12. label: as.label,
  13. slug: as.slug,
  14. fa_icon: as.fa_icon,
  15. hexcolor: as.hexcolor,
  16. global_status: as.global_status
  17. }))
  18. }))
  19. default:
  20. return state
  21. }
  22. }
  23. export default contentType