I had a question regarding best practice when it comes to building a global utility class in EmberJS when the class will exhibit user-specific behavior.
The following conditions are all true:
- The class's methods could be accessed from anywhere in the entire application.
- The application performs JSON based authentication using Ember-Simple-Auth.
- The authentication confirmation payload comes with some information about the user.
- The information received in the token payload will determine the behavior of the utility class's function.
My Questions
-
Is a Util the best option? Should I be using services and somehow "initialize" this service on a confirmed authentication? My end goal is to use this class from almost every route/template/component in my application.
-
How chill are authentication payloads? Is it OK to send crumbs of user specific information information in the authentication payload in addition to any tokens?
Aucun commentaire:
Enregistrer un commentaire