
// bootstrap css
import '../../css/main.css';

import React from 'react';
import PureComponent from 'react-pure-render/component';
import ReactDOM from 'react-dom';

// Router
import { browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';

// Redux
import { Provider } from 'react-redux';
import configureStore from './store/configureStore';

import * as AccountActions from './actions/account';

import MainRouter from './routers';

const store = configureStore();
const history = syncHistoryWithStore(browserHistory, store);

class App extends PureComponent {
    render() {
        return (
            <Provider store={store}>
                <MainRouter history={history} />
            </Provider>
        );
    }
}

function getPromise(fetchFunc, ...extraParams) {
    return new Promise((resolve, reject) => {
        fetchFunc(resolve, reject, ...extraParams);
    });
}

function getToken(resolve) {
    // Check localStorage QustomPortal, Verify toekn
    const token = window.localStorage.QustomPortalTK || '';
    console.log(`token:${token}`);

    // TODOS: wait for backend API, temporarily
    if (token === '') {
        const data = {
            accountid: '123456',
            username: 'Chiou Chu',
            role: 'Designer'
        };
        store.dispatch(AccountActions.receiveAccountSuccess(data));
        resolve('Finish Verify Token');
        window.localStorage.QustomPortalTK = '';
        return;
    }

    if (token) {
        store.dispatch(AccountActions.verifyToken(token))
        .then(() => {
            resolve('Finish Verify Token');
        });
    } else {
        resolve('No Token');
    }
}

getPromise(getToken)
.then(() => {
    // initApp
    ReactDOM.render(
        <App />,
        document.getElementById('main')
    );
});

if (module.hot) {
    module.hot.accept();
}

@@ -1064,426 +1064,8 @@
  '';
-%0A    console.log(%60token:$%7Btoken%7D%60);%0A%0A    // TODOS: wait for backend API, temporarily%0A    if (token === '') %7B%0A        const data = %7B%0A            accountid: '123456',%0A            username: 'Chiou Chu',%0A            role: 'Designer'%0A        %7D;%0A        store.dispatch(AccountActions.receiveAccountSuccess(data));%0A        resolve('Finish Verify Token');%0A        window.localStorage.QustomPortalTK = '';%0A        return;%0A    %7D
 %0A%0A  

Remove useless develop code