{"size": 925, "ext": "js", "max_stars_repo_path": "src/API/Fetch.js", "max_stars_repo_name": "Edwik/React-Curso-Intensivo", "max_stars_repo_stars_event_min_datetime": "2020-04-17T01:09:05.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-17T02:26:18.000Z", "max_issues_repo_path": "src/API/Fetch.js", "max_issues_repo_name": "Edwik/React-Curso-Intensivo", "max_issues_repo_issues_event_min_datetime": "2020-04-17T02:05:03.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T03:13:48.000Z", "max_forks_repo_path": "src/API/Fetch.js", "max_forks_repo_name": "Edwik/React-Curso-Intensivo", "max_forks_repo_forks_event_min_datetime": "2020-04-16T23:57:55.000Z", "max_forks_repo_forks_event_max_datetime": "2020-04-17T02:24:41.000Z"}
{"max_stars_count": 2, "max_issues_count": 6, "max_forks_count": 2, "avg_line_length": 21.511627907, "max_line_length": 65, "alphanum_fraction": 0.6248648649}

// const DEFAULT_URL = 'https://'

const defaultHeaders = new Headers()

export const Fetch = async (method, URL, data, extraHeaders) => {

  if ((!defaultHeaders.has('content-type'))){
    defaultHeaders.append('content-type','application/json')
  }

  defaultHeaders.append('access-control-allow-origin', '*')
  defaultHeaders.append('Access-Control-Allow-Methods', '*')
  
  if (extraHeaders){
    extraHeaders.forEach((item,)=>{
      defaultHeaders.append(item.key, item.value)
    })
  }

  const requestInit = {
    method: method,
    headers: new Headers(defaultHeaders),
  }

  if (data){
    requestInit.body = JSON.stringify(data)
  }

  // return await fetch(
  //   DEFAULT_URL + URL,
  //   requestInit
  // ).then(res => res ? res.json() : {})

  return { 
    status: 200,
    data: {
      displayName: 'Edwin Anaya',
      email: 'eanaya@gmail.com',
    },
    msg: '¡Usuario Logueado Exitosamente!'
  }
}