I've encountered a problem with my Vue registration where clicking on the register button redirects me to the home page. I believe setting some conditions might help resolve this issue. How can I prevent this redirection? Any suggestions?
register() {
firebase.auth().createUserWithEmailAndPassword(this.email, this.lozinka)
.then(function() {
console.log('Success');
let id = this.email
db.collection("user")
.doc(id)
.set({
korisnicko_ime: this.korisnicko_ime,
email: this.email,
lokacija: this.lokacija,
ime_objekta: this.ime_objekta,
kontakt: this.kontakt,
})
.then((doc) => {
console.log("Saved", doc)
})
})
.catch(function(error) {
console.error("Error...", error);
if (store.currentUser = null) {
this.$router.replace({ name: 'Register'});
}
});
console.log('Continue');
this.$router.replace({ name: 'Home'});
},