diff --git a/src/components/Auth/LoginRegister.vue b/src/components/Auth/LoginRegister.vue index dbc2bd1..b72fe72 100644 --- a/src/components/Auth/LoginRegister.vue +++ b/src/components/Auth/LoginRegister.vue @@ -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) } diff --git a/src/store/store-auth.js b/src/store/store-auth.js index cf7219f..c55cb80 100644 --- a/src/store/store-auth.js +++ b/src/store/store-auth.js @@ -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) + }) } }