3

I was wondering what are the best practices to store an user object and make it accessible through my whole Polymer app. Since I'm using a lot of template imports, I'm getting a little bit lost on how to access my user object retrieved from my <x-login id="xlogin" user="{{user}}"></x-login> template imported by my my-app template. I'm using <firebase-auth> for authentication.

Let's say I'm five template levels deep and I want to access my refreshToken which is in my {{user}} object, what is the best way to get this?

  • Do I have to do a querySelector for my element with id #login?

  • Or do I have to pass the user object through all my nested elements?

  • Or do I have to include <firebase-auth app-name="projectMeta" id="auth" user="{{user}}"></firebase-auth> in all my pages where I want to get my userdata?

  • Or are there better/cleaner ways to achieve this?

Rover
  • 387
  • 4
  • 14
  • To extend this question; I'm working with `paper-toast` now. What is the best way to only have to include this element once and make it accessible throughout my whole polymer app? – Rover Nov 29 '16 at 13:31

0 Answers0