tiberiuc / redux-react-firebase

Use Firebase with React and Redux in ES6
MIT License
248 stars 36 forks source link

User profile is undefined #54

Open gazpachu opened 7 years ago

gazpachu commented 7 years ago

I'm following the auth example, but the user profile comes as undefined, although the auth object is fine:

@firebase()
@connect(
    (state, props) => ({
        user: pathToJS(state.firebase, 'auth'),
        profile: pathToJS(state.firebase, 'profile')
    })
)
const createStoreWithFirebase = compose(
    reduxReactFirebase(firebaseConfig, {userProfile: 'users'}),
    window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore);

I've also tried without the devTools stuff, but no luck.

I do have the 'users' node in my Firebase database, although no ID is being created in the 'users' node when using firebase.createUser(credentials, { name.value }), which might be the real cause of the issue...

BTW, in the docs says: "profile if initialized with userProfile support then profile will be saved into ${userProfile}/${auth.uid}", so that means it should create the new key in the 'users' node.

I've also tried to rename userProfile to profile in the store, but it doesn't make any effect:

reduxReactFirebase(firebaseConfig, {profile: 'users'}),

webbushka commented 7 years ago

@gazpachu I was having this same problem, looking at the source for reduxReactFirebase it only accepts one object. If you merge the firebase config with { userProfile: 'users' } then it works.