Created
April 14, 2020 12:24
-
-
Save Serhansolo/c8991ed0a503afbb01da01ee2abea6f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import firebase from "firebase/app"; | |
const actions = { | |
signUpAction({ commit }, payload) { | |
firebase | |
.auth() | |
.createUserWithEmailAndPassword(payload.email, payload.password) | |
.then(response => { | |
commit("setUser", response.user); | |
}) | |
.catch(error => { | |
commit("setError", error.message); | |
}); | |
}, | |
signInAction({ commit }, payload) { | |
firebase | |
.auth() | |
.signInWithEmailAndPassword(payload.email, payload.password) | |
.then(response => { | |
commit("setUser", response.user); | |
}) | |
.catch(error => { | |
commit("setError", error.message); | |
}); | |
}, | |
signOutAction({ commit }) { | |
firebase | |
.auth() | |
.signOut() | |
.then(() => { | |
commit("setUser", null); | |
}) | |
.catch(error => { | |
commit("setError", error.message); | |
}); | |
} | |
}; | |
export default actions; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment