I am looking for a stylish strategy for retrieving current user information using emberjs (and ember-data).
I am currently doing the following:
My API is responding /users/mewith the current user.
In my adapter, when the identifier of the returned object is not the one I hope for, I add real_idwhich is the identifier (the user identifier in the database), and I replace the real returned identifier with what I expect.
So, when my adapter has an “I” as the user id, but the server returns 1, I get the following json:
{"real_id": 1, "id": "me"}
It works. But I'm not a big fan, and I would like to avoid as little as possible in order to change the default contents of the adapter.
Are you using any strategy for this? What would you recommend?
source
share