The login method is badly written, everytime you login, it reads the database to check if the user has its own collection or not.
I am talking about this file
authentication.actions.js
Here is how i fixed it for me
login: async ({ commit, dispatch }, firebaseAuthUser) => {
// ########## ctime is the account creation timestamp. stime is the last login timestamp ########
const ctime = firebaseAuthUser.metadata.a
const stime = firebaseAuthUser.metadata.b
let user
// ########## CHECK IF THE USER LOGGED IN FOR THE FIRST TIME ########
if (ctime === stime){
user = await createNewUserFromFirebaseAuthUser(firebaseAuthUser)
} else {
const authuser = firebaseAuthUser.providerData[0]
user = {displayName:authuser.displayName , id: firebaseAuthUser.uid, email:authuser.email, photoURL:authuser.photoURL, created:ctime , lastLogin:stime}
}
commit('setUser', user)
dispatch('products/getUserProducts', null, { root: true })
}
No more useless reads , and it's faster. If someone can put a pull request for this because i didn't fork the repo
The login method is badly written, everytime you login, it reads the database to check if the user has its own collection or not.
I am talking about this file
authentication.actions.js
Here is how i fixed it for me
No more useless reads , and it's faster. If someone can put a pull request for this because i didn't fork the repo