import {
  FETCH_USER_PENDING,
  FETCH_USER_REJECTED,
  FETCH_USER_FULFILLED,
} from './actionTypes';

const initialState = {
  isFetching: false,
  isFetched: false,
  error: null,
  request: null,
  users: {

  },
};

const reducer = (state = { ...initialState }, action) => {
  switch (action.type) {
    case FETCH_USER_PENDING: {
      return { ...state, isFetching: true };
    }
    case FETCH_USER_REJECTED: {
      return { ...state, isFetching: false, error: action.payload };
    }
    case FETCH_USER_FULFILLED: {
      return {
        ...state,
        isFetching: false,
        isFetched: true,
        request: action.payload,
      };
    }
  }
  return state;
};

export default reducer;

@@ -219,14 +219,555 @@
  %7B%0D%0A
-%0D%0A  %7D,
+    %22jason-kao%22: %7B%0D%0A      id: 0,%0D%0A      firstName: %22Jason%22,%0D%0A      lastName: %22Kao%22,%0D%0A      username: %22jkao1%22,%0D%0A      email: %22jkao1@stuy.edu%22,%0D%0A      description: %22Jason is a web editor for The Spectator.%22%0D%0A    %7D%0D%0A  %7D,%0D%0A  roles: %7B%0D%0A    0: %7B%0D%0A      id: 0,%0D%0A      title: %22Contributor%22,%0D%0A      slug: %22contributors%22,%0D%0A      credentials: 0%0D%0A    %7D,%0D%0A  %7D,%0D%0A  userRoles: %5B%0D%0A    %7B%0D%0A      userSlug: %22jason-kao%22,%0D%0A      roleID: 0%0D%0A    %7D%0D%0A  %5D,%0D%0A  authorship: %5B%0D%0A    %7B%0D%0A      articleSlug: %22apples-rain-in-new-york-city%22,%0D%0A      userSlug: %22jason-kao%22%0D%0A    %7D%0D%0A  %5D
 %0D%0A%7D;

set user initial state