<commit_before>import store from '../store'
import vm from '../main'

import { RESPONSE_MESSAGES } from '../config'

const internals = {}

internals.responseError = function (error) {
  let response = error.response

  // var Notification = $injector.get('Notification');

  // EXPL: If the access token was expired, allow the apiHelperService to try a refresh token
  if (response.status === 401 && response.data.message === RESPONSE_MESSAGES.EXPIRED_ACCESS_TOKEN) {
    console.debug('authInterceptor.service: 401: response:', response)

    response = RESPONSE_MESSAGES.EXPIRED_ACCESS_TOKEN

  // EXPL: If the token was invalid or the Refresh Token was expired, force user to login
  } else if (response.status === 401) {
    console.debug('authInterceptor.service: 401: response:', response)

    store.dispatch('auth/clearAuth')

    vm.$router.push('/login')
  } else if (response.status === 403) { // EXPL: The user is unauthorized
    console.debug('authInterceptor.service: 403: response:', response)

    vm.$snotify.warning('You are not authorized for that action', 'Warning')
  }
  // EXPL: If not a 401 or 403, do nothing with this error. This is necessary to make a `responseError`
  // interceptor a no-op. */
  return Promise.reject(response)
}

export default {
  responseError: internals.responseError
}<commit_msg>Updated unauthorized message to display specific error.<commit_after>import store from '../store'
import vm from '../main'

import { RESPONSE_MESSAGES } from '../config'

const internals = {}

internals.responseError = function (error) {
  let response = error.response

  // var Notification = $injector.get('Notification');

  // EXPL: If the access token was expired, allow the apiHelperService to try a refresh token
  if (response.status === 401 && response.data.message === RESPONSE_MESSAGES.EXPIRED_ACCESS_TOKEN) {
    console.debug('authInterceptor.service: 401: response:', response)

    response = RESPONSE_MESSAGES.EXPIRED_ACCESS_TOKEN

  // EXPL: If the token was invalid or the Refresh Token was expired, force user to login
  } else if (response.status === 401) {
    console.debug('authInterceptor.service: 401: response:', response)

    store.dispatch('auth/clearAuth')

    vm.$router.push('/login')
  } else if (response.status === 403) { // EXPL: The user is unauthorized
    console.debug('authInterceptor.service: 403: response:', response)

    vm.$snotify.warning('Not authorized: ' + response.data.message, 'Warning')
  }
  // EXPL: If not a 401 or 403, do nothing with this error. This is necessary to make a `responseError`
  // interceptor a no-op. */
  return Promise.reject(response)
}

export default {
  responseError: internals.responseError
}
{'fraction_non_alphanumeric': 0.11992619926199262, 'fraction_numerical': 0.017712177121771217, 'mean_word_length': 4.020370370370371, 'pattern_counts': {'":': 0, '<': 3, '<?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': '963597', 'n_tokens_mistral': 847, 'n_tokens_neox': 768, 'n_words': 250}