<commit_before>export default function auth () {
  return new Promise((resolve, reject) => {
    setTimeout(() => resolve({
      name: '<NAME>',
      avatar: 'https://pbs.twimg.com/profile_images/378800000605536525/891a881bde93a1fc3e289528fb859b96_400x400.jpeg',
      uid: 'the-uid'
    }), 2000)
  })
}

export function checkIfAuthed (store) {
  return store.getState().isAuthed
}

export function logout () {
  console.log('Logged Out!')
}<commit_msg>Swap mock auth with real auth<commit_after>import { ref } from 'config/constants'
import { authUser, fetchingUserSuccess } from 'redux/modules/users'
import { formatUserInfo } from 'helpers/utils'

export default function auth () {
  return ref.authWithOAuthPopup('facebook')
}

export function checkIfAuthed (store) {
  const authData = ref.getAuth()
  if (authData === null) {
    return false
  } else if ( store.getState().isAuthed === false) {
    const { uid, facebook } = authData
    const userInfo = formatUserInfo(facebook.displayName, facebook.profileImageURL, uid)
    store.dispatch(authUser(uid))
    store.dispatch(fetchingUserSuccess(uid, userInfo, Date.now()))
  }
  return true
}

export function logout () {
  ref.unauth()
}

export function saveUser (user) {
  console.log(user);
  return ref.child(`users/${user.uid}`)
    .set(user)
    .then(() => user)
}
{'fraction_non_alphanumeric': 0.13793103448275862, 'fraction_numerical': 0.03673163418290855, 'mean_word_length': 4.21484375, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '3349792', 'n_tokens_mistral': 467, 'n_tokens_neox': 438, 'n_words': 97}