1👍
✅
Other comments and answers are suggesting to use a store and it should be what you are searching for in your project. As you are using Vue3 and Typescript, I would recommend using Pinia which is the current up to date store manager for recent Vue applications and not VueX which is the older store manager.
You can find really good examples in the documentation. I personally used Pinia in a similar fashion in a personal project, maybe this can help you.
0👍
You can create a mutation using vuex. So all child children and parent parents can interact from anywhere
example : https://jasonwatmore.com/post/2018/07/14/vue-vuex-user-registration-and-login-tutorial-example
Moreover :
export async function getAuthUserID(): Promise<string | undefined> {
return await new Promise( (resolve, reject) => {
firebase.auth().onIdTokenChanged(async (user) => {
if (!user) {
resolve(undefined);
} else {
resolve(user.uid);
}
})
}).then((uid: string | undefined)=>uid).catch(function(e) {
throw (e);
});
}
Source:stackexchange.com