import {
  GET_THEME,
} from 'Constants/actionTypes';
import { handleAction } from 'redux-actions';

const defaultState = {
};

const reducer = handleAction(GET_THEME, (state, action) => ({
  ...state,
  header: {
    ...action.payload.items[0].fields.header.fields,
    icons: action.payload.items[0].fields.header.fields.icons.map(value => ({
      alt: value.fields.alt,
      internal: value.fields.internal,
      url: value.fields.url,
      assetUrl: value.fields.icon.fields.file.url,
    })),
  },
  mainMenu: {
    ...action.payload.items[0].fields.mainMenu.fields,
    icons: action.payload.items[0].fields.mainMenu.fields.icons.map(value => ({
      alt: value.fields.alt,
      internal: value.fields.internal,
      url: value.fields.url,
      assetUrl: value.fields.icon.fields.file.url,
    })),
  },
}), defaultState);

export { reducer, defaultState };

@@ -811,16 +811,740 @@
 ),%0A  %7D,%0A
+  footer: %7B%0A    ...action.payload.items%5B0%5D.fields.footer.fields,%0A    icons: action.payload.items%5B0%5D.fields.footer.fields.icons.map(value =%3E (%7B%0A      alt: value.fields.alt,%0A      internal: value.fields.internal,%0A      url: value.fields.url,%0A      assetUrl: value.fields.icon.fields.file.url,%0A    %7D)),%0A    locationIcon: %7B%0A      alt: action.payload.items%5B0%5D.fields.footer%0A        .fields.locationIcon.fields.alt,%0A      internal: action.payload.items%5B0%5D.fields.footer%0A        .fields.locationIcon.fields.internal,%0A      url: action.payload.items%5B0%5D.fields.footer%0A        .fields.locationIcon.fields.url,%0A      assetUrl: action.payload.items%5B0%5D.fields.footer%0A        .fields.locationIcon.fields.icon.fields.file.url,%0A    %7D,%0A  %7D,%0A
 %7D), defa

add footer state