title: Redux automatically return initalState after some action call
body: <p>I am using react-redux and the reducer automatically return the inital state on call of an action, for example(given code) when i call the fetchPost action or the createPost action my Auth reducer automatically return the inital state.
  why is it happening so i am using redux-thunk and backend with feathersJS.</p>
  
  <pre><code>
  export const login = (payload) =&gt; dispatch =&gt; {
      AsyncStorage.getItem('feathers-jwt').then(r =&gt; {
          dispatch({ type: 'CHECK_AUTHORIZATION', payload: r })
      }).catch(() =&gt; {
          client.authenticate({
              strategy: 'local',
              email: payload.email,
              password: payload.password
          }).then(r =&gt; {;
              dispatch({ type: 'LOGIN_REQUEST', payload: r })
          }).catch(e =&gt; {
              dispatch({ type: 'LOGIN_ERROR', payload: e.message })
          })
      })
  }
  
  export const checkAuthorization = () =&gt; dispatch =&gt; {
      AsyncStorage.getItem('feathers-jwt').then(r =&gt; {
          dispatch({ type: 'CHECK_AUTHORIZATION', payload: r });
       return client.passport.verifyJWT(r);
          }).then(payload =&gt; {
              dispatch({ type: 'JWT_PAYLOAD', payload: payload })
              return client.service('users').get(payload.userId);
          }).then(user =&gt; {
              client.set('user', user);
              client.get('user').then(user =&gt; {
                  dispatch({ type: 'PROFILE', payload: user })
              })
          })
      .catch(() =&gt; {
          dispatch({ type: 'AUTHORIZATION_FAILED' })
      })
  }
  
  export const logout = (payload) =&gt; dispatch =&gt; {
      client.logout().then(r =&gt; dispatch({ type: 'LOG_OUT', payload: r }))
  }
  
  </code></pre>
  
  <pre><code>import actions from './actions';
  import AsyncStorage from '@react-native-community/async-storage';
  
  const initalState = {
    users: [],
    isAuthenticated: false,
    accessToken: null,
    profile: null,
    isVendor: false,
    isConsumer: false,
    errorMessage: null,
    jwtPayload: null
  };
  
  export default (state = initalState, action) =&gt; {
      switch (action.type) {
          case 'CHECK_AUTHORIZATION':
              return Object.assign({}, state, {
                  accessToken: action.payload,
                  isAuthenticated: true
              })
          case 'AUTHORIZATION_FAILED':
              return Object.assign({}, state, {
                  isAuthenticated: initalState.isAuthenticated
              })
          case 'LOGIN_REQUEST':
              return (
                  Object.assign({}, state, {
              accessToken: action.payload.accessToken,
              isAuthenticated: true,
          }));
          case 'JWT_PAYLOAD':
              return Object.assign({}, state, {
                  jwtPayload: action.payload
              })
          case 'PROFILE':
              return Object.assign({}, state, {
                  profile: action.payload
              })
          case 'LOGIN_ERROR':
              return Object.assign({}, state, {
                  errorMessage: action.payload.message
              })
          case 'LOG_OUT': 
              return Object.assign({}, state, {
                  isAuthenticated: initalState.isAuthenticated,
                  accessToken: null
              })
          default:
              return initalState;
          }
  }
  </code></pre>