Open hatboysam opened 4 years ago
Huh ok I guess undefined
is no good in vue stores? Changing the module to this made it work:
export default class Auth extends VuexModule {
public user: firebase.User | null = null;
@Mutation
setUser(u: firebase.User | null) {
console.log(`auth.setUser(${u ? u.uid : u})`);
this.user = u;
}
}
Actually I'll leave this open in case some kind traveler wants to explain what happened here to me, although if the answer is just "don't use undefined
" you can close it.
Please excuse the total n00b question, I'm just trying to understand how this is meant to be used in the most type-safe way.
I've got a module that looks like this:
I access it in my component like this:
That logs out this:
What's the best way to access
user
fromAuthModule
? I'd prefer not to access it from$state
because that's not typesafe.