function* fetchUser() {
  try {
    const config = {
      headers: { 'Content-Type': 'application/json' },
      withCredentials: true,
    };

    // the config includes credentials which
    // allow the server session to recognize the user
    // If a user is logged in, this will return their information
    // from the server session (req.user)
    const response = yield axios.get('/api/user/login', config);

    // now that the session has given us a user object
    // with an id and username set the client-side user object to let
    // the client-side code know the user is logged in
    yield put({ type: 'SET_USER', payload: response.data });
    yield all([
      put({ type: 'FETCH_CONDITIONAL' }),
      put({ type: 'FETCH_CLIMBS' }),
      put({ type: 'FETCH_TEAMS' }),
      put({ type: 'FETCH_LEAGUES' }),
      put({ type: 'FETCH_LEAGUE_TEAMS' })
    ]);
  } catch (error) {
    console.log('User get request failed', error);
  }
}
// worker Saga: will be fired on "FETCH_USER" actions
worker Saga: will be fired on "FETCH_USER" actions
worker Saga : will be fired on " FETCH_USER " actions
function* fetchUser() {
  try {
    const config = {
      headers: { 'Content-Type': 'application/json' },
      withCredentials: true,
    };
    const response = yield axios.get('/api/user/login', config);
    yield put({ type: 'SET_USER', payload: response.data });
    yield all([
      put({ type: 'FETCH_CONDITIONAL' }),
      put({ type: 'FETCH_CLIMBS' }),
      put({ type: 'FETCH_TEAMS' }),
      put({ type: 'FETCH_LEAGUES' }),
      put({ type: 'FETCH_LEAGUE_TEAMS' })
    ]);
  } catch (error) {
    console.log('User get request failed', error);
  }
}
function * fetchUser ( ) { try { const config = { headers : { 'Content-Type' : 'application/json' } , withCredentials : true , } ; const response = yield axios . get ( '/api/user/login' , config ) ; yield put ( { type : 'SET_USER' , payload : response . data } ) ; yield all ( [ put ( { type : 'FETCH_CONDITIONAL' } ) , put ( { type : 'FETCH_CLIMBS' } ) , put ( { type : 'FETCH_TEAMS' } ) , put ( { type : 'FETCH_LEAGUES' } ) , put ( { type : 'FETCH_LEAGUE_TEAMS' } ) ] ) ; } catch ( error ) { console . log ( 'User get request failed' , error ) ; } }
worker Saga: will be fired on "FETCH_USER" actions
worker Saga : will be fired on " FETCH_USER " actions
// the config includes credentials which // allow the server session to recognize the user // If a user is logged in, this will return their information // from the server session (req.user) // now that the session has given us a user object // with an id and username set the client-side user object to let // the client-side code know the user is logged in