18.05 Login User

This commit is contained in:
fwarren committed 2021-02-13 12:00:48 -08:00
1 parent abe5306e9c
commit b6d9272317
2 files changed
+13 -3

No files matched your search

+4 -3
View File
@@ -65,8 +65,9 @@ export default {
},
methods: {
...mapActions('auth', [
'registerUser']
),
'registerUser',
'loginUser'
]),
isValidEmailAddress (email) {
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(String(email).toLowerCase())
@@ -78,7 +79,7 @@ export default {
this.$refs.password.validate()
if (!this.$refs.email.hasError && !this.$refs.password.hasError) {
if (this.tab === 'login') {
console.log('login')
this.loginUser(this.formData)
} else {
this.registerUser(this.formData)
}
+9
View File
@@ -15,6 +15,15 @@ const actions = {
.catch(error => {
console.log('error.message: ', error)
})
},
loginUser ({ state }, payload) {
firebaseAuth.signInWithEmailAndPassword(payload.email, payload.password)
.then(response => {
console.log('response: ', response)
})
.catch(error => {
console.log('error.message: ', error)
})
}
}