src/schema.js
function fetchPageOfType(typePluralName, pageNumber) {
  let url = `http://swapi.co/api/${typePluralName}/`;
  if (pageNumber) {
    url += `?page=${pageNumber}`;
  };

  return restLoader.load(url).then((data) => {
    // Paginated results have a different shape
    return data.results;
  });
}
function fetchPageOfType(typePluralName, pageNumber) {
  let url = `http://swapi.co/api/${typePluralName}/`;
  if (pageNumber) {
    url += `?page=${pageNumber}`;
  };

  return restLoader.load(url).then((data) => {
    // Paginated results have a different shape
    return data.results;
  });
}
function fetchPageOfType ( typePluralName , pageNumber ) { let url = ` ${ typePluralName } ` ; if ( pageNumber ) { url += ` ${ pageNumber } ` ; } ; return restLoader . load ( url ) . then ( ( data ) => { // Paginated results have a different shape return data . results ; } ) ; }
A helper to unwrap the paginated object from SWAPI
A helper to unwrap the paginated object from SWAPI