Initial git
This commit is contained in:
29
app/helpers/index.jsx
Normal file
29
app/helpers/index.jsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import {firebaseAuth, firebaseRef} from 'app/firebase/'
|
||||
|
||||
export function auth(email, pw, other) {
|
||||
return firebaseAuth().createUserWithEmailAndPassword(email, pw)
|
||||
.then(u => saveUser(u,other))
|
||||
}
|
||||
|
||||
export function logout() {
|
||||
return firebaseAuth().signOut()
|
||||
}
|
||||
|
||||
export function login(email, pw) {
|
||||
return firebaseAuth().signInWithEmailAndPassword(email, pw)
|
||||
}
|
||||
|
||||
export function resetPassword(email) {
|
||||
return firebaseAuth().sendPasswordResetEmail(email)
|
||||
}
|
||||
|
||||
export function saveUser(user,other) {
|
||||
return firebaseRef.child(`users/${user.uid}/info`)
|
||||
.set({
|
||||
...other,
|
||||
email: user.email,
|
||||
uid: user.uid
|
||||
|
||||
})
|
||||
.then(() => user)
|
||||
}
|
||||
Reference in New Issue
Block a user