-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for v9 beta #531
Comments
When I talked to @lupas on discord a while back, he alluded to the possibility of updating the nuxt module for this. Lets hope he does! |
Hey guys Been playing around with v9 Beta lately and I completely love it, but it will require quite the refactoring of the module. Many things of this module might even not make sense anymore... so I would probably have to build it up from scratch. Definitely don't have time at the moment, and since it's still in Beta I will probably tackle this later this year. If anyone wants to start a branch and start working on it, feel free, would appreciate it! We might be able to simplify many things with v9. |
Wrote a short Medium article on how to setup Firebase v9 Beta in Nuxt.js (without this module). |
@lupas Love your medium article, but what benefits/advantages would an upgraded Nuxt/Firebase module have over the regular firebase plugin you made in the medium article? You stated that many of the features in your previous Firebase module may no longer be needed. Thanks for any insight! |
@dosstx |
I've so far implemented the new v9 SDK into my app. So far so good, however, not sure how to "hook up" the onAuthStateChanged action? Can you or someone provide an example? Are we putting this back in |
@dosstx For regular auth: Haven't tried it myself yet but you should be able to just create a import { onAuthStateChanged } from "firebase/auth";
export default ({ store }) => {
onAuthStateChanged(auth, (user) => {
if (user) {
store.commit("SET_USER", {
email: user.email,
});
} else {
store.commit("UNSET_USER");
}
});
}; Load the plugin on client side only and it should be all fine. |
Sorry to bother again about this....but @lupas ...with your above
I need to only let a user sign in after their email is verified. So, in your plugin code, I have:
Problem is that I can't use the Hope my question makes sense. |
@dosstx import { onAuthStateChanged } from "firebase/auth";
export default ({ store }) => {
const unsubscribeAuthListener = onAuthStateChanged(auth, (user) => {
if (user) {
store.commit("SET_USER", {
email: user.email,
});
} else {
store.commit("UNSET_USER");
}
});
store.commit("SET_AUTH_LISTENER", unsubscribeAuthListener); // <--- do this, and add the mutation also
} And then somewhere in your code, unsubscribe like so: // assuming you named it `unsubscribeAuthListener` in your state
store.state.unsubscribeAuthListener() |
Thanks! I think your solution is more simple. I had an overengineered version of this where I could just inject the plugin into my components and be able to use
and my store stuff:
Then, in my sign up page I unsubscribe to listener like so:
The use case for me is that the data model requires two root collections It works...but I am still in testing stage. Thanks! |
Is it still relevant to open a branch and start working on it? |
See #573 |
Following the keynote yesterday they released the v9 Javascript SDK. This has support for treeshaking, firestore-lite and other benefits.
I'm not sure if you'd want to support something that's still in beta but I just thought I'd put it on your radar
The text was updated successfully, but these errors were encountered: