{"size": 570, "ext": "js", "max_stars_repo_path": "src/functions/check-subscription-status.js", "max_stars_repo_name": "kniffen/FullStream", "max_stars_repo_stars_event_min_datetime": "2016-06-03T19:49:31.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-03T19:49:31.000Z", "max_issues_repo_path": "src/functions/check-subscription-status.js", "max_issues_repo_name": "kniffen/FullStream", "max_issues_repo_issues_event_min_datetime": "2019-01-29T11:12:13.000Z", "max_issues_repo_issues_event_max_datetime": "2019-02-02T17:57:20.000Z", "max_forks_repo_path": "src/functions/check-subscription-status.js", "max_forks_repo_name": "kniffen/FullStream", "max_forks_repo_forks_event_min_datetime": "2016-06-30T20:36:11.000Z", "max_forks_repo_forks_event_max_datetime": "2016-10-31T20:43:48.000Z"}
{"max_stars_count": 1, "max_issues_count": 4, "max_forks_count": 2, "avg_line_length": 25.9090909091, "max_line_length": 102, "alphanum_fraction": 0.6649122807}
export default async function checkSubscriptionStatus(userID, channelID) {

  const res = await fetch(`https://api.twitch.tv/kraken/users/${userID}/subscriptions/${channelID}`, {
    headers: {
      'Client-ID': process.env.VUE_APP_CLIENT_ID,
      'Authorization': `OAuth ${localStorage.token}`,
      'Accept': 'application/vnd.twitchtv.v5+json'
    }
  })

  if ([400, 401].includes(res.status)) {
    delete localStorage.token
    document.body.classList.add('show-login')
    return false
  
  } else if (res.status == 200) {
    return true
  }

  return false

}