A
A
Alexander Belkevich2018-08-02 14:23:25
firebase
Alexander Belkevich, 2018-08-02 14:23:25

How to get currentUser in Vue?

Hello. Tell. Through middleware I want to see the currentUser from Firebase. For now, just look, then I will use it to protect routes.
The problem is that user is always null. Even though I'm logged in.
Alternatively, maybe I’ll say something stupid and I’m wrong, but this is due to the fact that the middleware is loaded ahead of the rest and does not yet receive the currentUser state. And then how to be? Or maybe another reason?
Since I still use Vuex, I tried to check by getter from store. But in fact, everything is the same ...
For fun, I tried it through a timeout - also to no avail ...
5b62e9a943b80687121818.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Novikov, 2018-08-02
@dvnovikov

Maybe it's worth making this request async/await?

A
alex_kulkoff, 2018-09-17
@alex_kulkoff

Won or not? I have a similar problem, only I have already created a rule for the router. I store the user in the state, when the page is updated it is null, the rule is triggered, then it is no longer null, the menu from the App is loaded and the registration hangs in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question