import * as types from '../actions/db';


export default function (state = {
  isFetching: false,
  didInvalidate: false,
  items: [],
}, action) {
  switch (action.type) {
  case types.DB_CONNECT_SUCCESS: {
    return { ...state, didInvalidate: true };
  }
  case types.DB_FETCH_TABLES_REQUEST: {
    return { ...state, isFetching: true, didInvalidate: false, error: null };
  }
  case types.DB_FETCH_TABLES_SUCCESS: {
    return {
      ...state,
      isFetching: false,
      didInvalidate: false,
      items: action.tables,
      error: null,
    };
  }
  case types.DB_FETCH_TABLES_FAILURE: {
    return {
      ...state,
      isFetching: false,
      didInvalidate: true,
      error: action.error,
    };
  }
  default : return state;
  }
}

@@ -223,16 +223,27 @@
 ..state,
+ items: %5B%5D,
  didInva

Clear list of tables when db connection succeed