import 'whatwg-fetch';
import './public-path'
import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import './global.less';
import 'animate.css/animate.css';
import 'antd/dist/antd.less';
import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/extensions
import 'kit_utils/lib/format';
import 'sanitize.css/sanitize.css';
import { event } from 'microser-data';
import _ from 'lodash';
import { ConfigProvider} from 'antd';
import { Storeage } from 'kit_utils';
import { history } from '@wisdom-utils/runtime';
import { actionCreators } from './containers/App/store';
import { initGlobalConfig } from './initConfig'
import './utils/event';

import store from './stores'
const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace);
ConfigProvider.config({
  prefixCls: 'panda-console-base'
});
const initLocale = () => {
  localStorage.setItem('umi_locale', 'zh-CN');
};
// const PRODUCT_NAME = ['civ_water', 'civ_monitor'];

initGlobalConfig();
initLocale();
const unlisten = history.listen(location => {
  if(location.pathname.indexOf('/civbase/user/login') > -1) {
    initGlobalConfig();
  }
});

event.on('event:logout', () => {
  store.dispatch(actionCreators.logout())
});
