timed-frontend
timed-frontend copied to clipboard
fix(auth): refactor current user handling into service
Writing instances of JS classes directly to the data
property
of the ember simple auth service is problematic, because ember
simple auth always saves the serialized form of the class in
local storage. In our case, this caused issues when the application
is open in multiple tabs, and one tab triggers a token refresh: In that
case, the initialization of the class instance is not triggered, and the
serialized data is read directly from local storage.
This refactors the current implementation to use a separate service, as suggested by the ember-simple-auth docs: https://github.com/mainmatter/ember-simple-auth/blob/master/guides/managing-current-user.md