PolGuixe
7/1/2016 - 10:26 AM

Add a way to set default loading and error components #8

Add a way to set default loading and error components #8

// inside  client/modules/core/configs/react-komposer-configs.js

import {setDefaultErrorComponent, setDefaultLoadingComponent} from 'react-komposer';

const ErrorComponent = () => (
  <div>My Error</div>
);
const LoadingComponent = () => (
  <div>My Loading</div>
);

export default function() {
  setDefaultErrorComponent(ErrorComponent);
  setDefaultLoadingComponent(LoadingComponent);
}
// inside  client/modules/core/index.js

import actions from './actions';
import routes from './routes.jsx';
import configs from './configs';

export default {
  routes,
  actions,
  load(context) {
    configs(context);
  }
};
// inside  client/modules/core/configs/index.js

import reactKomposerConfig from './react-komposer-config';

export default function (context) {
  reactKomposerConfig();
}