title: how to parse json after exception handling promise with isomorphic-fetch
body: <p>During implementing login feature with React, Redux, isomorphic-fetch, ES6 Babel.  </p>
  
  <p><strong><em>Questions</em></strong>  </p>
  
  <p>I do not know how to properly combine promises after the checkstatus promise in order to get parsed JSON data from my server.<br>
  what am I doing wrong here?  </p>
  
  <p>also, do I need to replace <code>isomorphic-fetch</code> package with other more convenient one?<br>
  any suggestion for other package is welcome! </p>
  
  <p><strong>loginAction.js</strong></p>
  
  <pre><code>import * as API from '../middleware/api';
  import * as ActionTypes from '../actionTypes/authActionTypes';
  import 'isomorphic-fetch';
  
  function encodeCredentials(id, pwd) {
    return btoa(`${id}{GS}${pwd}`);
  }
  
  function checkStatus(response) {
    if (response.status &gt;= 200 &amp;&amp; response.status &lt; 300) {
      response;
    } else {
      const error = new Error(response.statusText);
      error.response = response;
      throw error;
    }
  }
  
  function parseJSON(response) {
    return response.json();
  }
  
  export function loginFailure(error) {
    return { error, type: ActionTypes.LOGIN_FAILURE };
  }
  
  export function loginSuccess(response) {
    return dispatch =&gt; {
      dispatch({ response, type: ActionTypes.LOGIN_SUCCESS });
    };
  }
  
  export function loginRequest(id, pwd) {
    return {
      type: ActionTypes.LOGIN_REQUEST,
      command: 'login',
      lang: 'en',
      str: encodeCredentials(id, pwd),
      ip: '',
      device_id: '',
      install_ver: '',
    };
  }
  
  
  export function login(id, pwd) {
    const credentials = loginRequest(id, pwd);
  
    return dispatch =&gt; {
      fetch(`${API.ROOT_PATH}${API.END_POINT.LOGIN}`, {
        method: 'post',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(credentials),
      })
      .then(checkStatus)
      .then(parseJSON)
      .then(data =&gt; {
        console.log(`parsed data ${data}`);
        dispatch(loginSuccess(data));
      })
      .catch(error =&gt; {
        console.log(`request failed ${error}`);
      });
    };
  
  }
  </code></pre>