<commit_before>import * as ACTION_TYPES from '../constants/action_types'

function extractToken(hash, oldToken) {
  const match = hash.match(/access_token=([^&]+)/)
  let token = !!match && match[1]
  if (!token) {
    token = oldToken
  }
  return token
}

export function checkAuth(dispatch, oldToken, location) {
  const token = extractToken(location.hash, oldToken)
  if (window.history && window.history.replaceState) {
    window.history.replaceState(window.history.state, document.title, window.location.pathname)
  } else {
    document.location.hash = '' // this is a fallback for IE < 10
  }
  if (token) {
    dispatch({
      type: ACTION_TYPES.AUTHENTICATION.USER_SUCCESS,
      payload: {
        response: {
          accessToken: token,
          tokenType: 'onboarding_auth',
          expiresIn: 7200,
          createdAt: new Date(),
        },
      },
    })
  } else {
    const url = `${ENV.AUTH_DOMAIN}/api/oauth/authorize.html
      ?response_type=token
      &scope=web_app+public
      &client_id=${ENV.AUTH_CLIENT_ID}
      &redirect_uri=${ENV.AUTH_REDIRECT_URI}`

    window.location.href = url
  }
}

export function resetAuth(dispatch, location) {
  checkAuth(dispatch, null, location)
}

<commit_msg>Remove unnecessary whitespace from url string.<commit_after>import * as ACTION_TYPES from '../constants/action_types'

function extractToken(hash, oldToken) {
  const match = hash.match(/access_token=([^&]+)/)
  let token = !!match && match[1]
  if (!token) {
    token = oldToken
  }
  return token
}

export function checkAuth(dispatch, oldToken, location) {
  const token = extractToken(location.hash, oldToken)
  if (window.history && window.history.replaceState) {
    window.history.replaceState(window.history.state, document.title, window.location.pathname)
  } else {
    document.location.hash = '' // this is a fallback for IE < 10
  }
  if (token) {
    dispatch({
      type: ACTION_TYPES.AUTHENTICATION.USER_SUCCESS,
      payload: {
        response: {
          accessToken: token,
          tokenType: 'onboarding_auth',
          expiresIn: 7200,
          createdAt: new Date(),
        },
      },
    })
  } else {
    const urlArr = [`${ENV.AUTH_DOMAIN}/api/oauth/authorize.html`]
    urlArr.push('?response_type=token&scope=web_app+public')
    urlArr.push(`&client_id=${ENV.AUTH_CLIENT_ID}`)
    urlArr.push(`&redirect_uri=${ENV.AUTH_REDIRECT_URI}`)
    window.location.href = urlArr.join('')
  }
}

export function resetAuth(dispatch, location) {
  checkAuth(dispatch, null, location)
}


{'fraction_non_alphanumeric': 0.1324165029469548, 'fraction_numerical': 0.00550098231827112, 'mean_word_length': 3.2362728785357735, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '318595', 'n_tokens_mistral': 817, 'n_tokens_neox': 812, 'n_words': 160}