Reputation: 1644
I have an issue when learning VueJS. I want to send data to Firebase, but it keeps telling me that the variables never used. I declare it inside a promise.
This is the script:
methods: {
register: function() {
const info = {
email: this.email,
password: this.passOne,
displayName: this.displayName
};
if(!this.error) {
Firebase.auth()
.createUserWithEmailAndPassword(info.email, info.password)
.then(
userCredentials => {
this.$router.replace('meetings');
},
error => {
this.error = error.message;
}
);
}
}
},
This is the error:
error 'userCredentials' is defined but never used no-unused-vars
Upvotes: 3
Views: 1364
Reputation: 2823
replace your $router.replace(...)
code like below
this.$router.replace({ name: 'meetings', params: { credentials: userCredentials } })
hope it will solve your issue.
Upvotes: 0
Reputation: 2856
Thats an es-lint error. To solve:
if(!this.error) {
Firebase.auth()
.createUserWithEmailAndPassword(info.email, info.password)
.then(
() => {
this.$router.replace('meetings');
},
or you can also ask es-lint to do not look for the next line:
//es-lint-disable-next-line no-unused-vars
.then( userCredentials => {
this.$router.replace('meetings');
},
Upvotes: 2