text: import axios from 'axios';
  
  // we will define a bunch of API calls here.
  
  const baseUrl = 'https://bg-emotion-tracker-be-a.herokuapp.com';
  
  const getAuthHeader = authState => {
    if (!authState.isAuthenticated) {
      throw new Error('Not authenticated');
    }
    return { Authorization: `Bearer ${authState.accessToken}` };
  };
  
  const getUserData = (url, authState) => {
    try {
      return axios
        .get(`${baseUrl}${url}`, { headers: getAuthHeader(authState) })
        .then(response => response.data);
    } catch (error) {
      return new Promise(() => {
        console.log(error);
        return [];
      });
    }
  };
  
  const getExampleData = () => {
    return axios
      .get(`https://jsonplaceholder.typicode.com/photos?albumId=1`)
      .then(response => response.data);
  };
  
  const getDSData = (url, authState) => {
    // here's another way you can compose together your API calls.
    // Note the use of GetAuthHeader here is a little different than in the getProfileData call.
    const headers = getAuthHeader(authState);
    if (!url) {
      throw new Error('No URL provided');
    }
    return axios
      .get(url, { headers })
      .then(res => JSON.parse(res.data))
      .catch(err => err);
  };
  
  export { getUserData };
  
  