josx / ra-data-feathers

A feathers rest client for react-admin
MIT License
157 stars 58 forks source link

logged in save user data #145

Open lalote opened 4 years ago

lalote commented 4 years ago

Hello, in feathersjs when you logged in, you get the accessToken and user data (at least default configuration) . The accessToken is saved at localStorage, so, there are any posibility of add a authClient.options for save the user data in localStorage too?

josx commented 4 years ago

Right now We are following the react-admin interface. At least we are putting on localstorage permissions and token.

But if you want to access to all other props in user you can always do a GET to that service.

nicholasnelson commented 4 years ago

@lalote Can you explain why this functionality should be included in ra-data-feathers, and not implemented elsewhere (e.g. in your application)?

If you need the user data to be saved immediately on login without retrieving it separately as @josx has suggested, I think the correct approach would be to listen for the login or authenticated events from the feathers client directly:

feathersClient.on('login', user => handleUserData(user));

FeathersJS .on(eventname, listener) documentation for reference.

I just don't see that the requested functionality should be the responsibility of ra-data-feathers. This library is just a connector between feathersClient and React Admin.

If you can explain why I'm wrong here, I'd be happy to write a pull request for you (as long as @josx is happy with it). Otherwise I'd suggest this issue should be closed as out of scope.

josx commented 4 years ago

Lets see what @lalote has to say before closing it.