Search code examples
ember.jslocal-storageember-simple-auth

Ember simple auth, how to update the store without using private API?


So I've been using the updateStore method on older versions of Ember simple auth (0.7.4). The reason is that, the user might change a certain setting of the application, for example he disables fx sounds, and I'd like to save this new setting in his session data, and persist the information in localStorage, so I would call the updateStore function, after setting this.set('session.fx', false)

I know updateStore is private, so is there a better way to do this? Also, what would be the best way to get direct access to the store in ESA 1.0 ? I used to call this.get('session.store'), but it seems this does not work anymore.

Thanks.


Solution

  • _updateStore is private API and you should never use it directly. Actually with 1.0 you cannot anymore anyway as you don't have access to the internal session anymore anyways. You don't ever need to update the store manually anyway though however as that happens automatically as soon as you set any property on the session data, e.g this.set('session.data.fx', false). Also see the API docs: http://ember-simple-auth.com/api/classes/SessionService.html#property_data