use ternary operator instead of if else

This commit is contained in:
Roman Cervantes 2019-08-09 12:12:47 -07:00
parent f98d18b4ed
commit 9c5dd5bce6

View file

@ -242,11 +242,9 @@ export default {
const docRef = db.collection('settings').doc(this.user.uid);
docRef.get().then((doc) => {
if (doc.exists) {
this.$store.commit('SET_SETTINGS', doc.data());
} else {
this.initSettings();
}
return doc.exists
? this.$store.commit('SET_SETTINGS', doc.data())
: this.initSettings();
}).catch(() => {
this.$bus.$emit('TOAST', { message: 'Authentication error', type: 'error' });
this.$router.push({ name: 'sessionExpired' });