import { ref, firebaseAuth } from '../config/constants'

export function auth (email, pw) {
  return firebaseAuth().createUserWithEmailAndPassword(email, pw)
    .then(saveUser)
    .catch((error) => console.log('Oops', error))
}

export function logout () {
  return firebaseAuth().signOut()
}

export function login (email, pw) {
  return firebaseAuth().signInWithEmailAndPassword(email, pw)
}

export function saveUser (user) {
  return ref.child(`users/${user.uid}/info`)
    .set({
      email: user.email,
      uid: user.uid
    })
    .then(() => user)
}
@@ -54,180 +54,94 @@
 s'%0A%0A
-export function auth (email, pw) %7B%0A  return firebaseAuth().createUserWithEmailAndPassword(email, pw)%0A    .then(saveUser)%0A    .catch((error) =%3E console.log('Oops', error))%0A%7D
+const provider = new firebaseAuth.GithubAuthProvider();%0Aprovider.addScope('read:org');
 %0A%0Aex
@@ -228,19 +228,9 @@
 ogin
- (email, pw
+(
 ) %7B%0A
@@ -267,35 +267,24 @@
 With
-EmailAndPassword(email, pw)
+Popup(provider);
 %0A%7D%0A%0A
@@ -448,8 +448,9 @@
  user)%0A%7D
+%0A

Use GitHub auth