AdaptiveStore
import AdaptiveStore from 'ember-simple-auth/session-stores/adaptive';
Session store that persists data in the browser's localStorage
(see
LocalStorageStore) if that is available or in
a cookie (see CookieStore) if it is not.
This is the default store that Ember Simple Auth will use when the application doesn't define a custom store.
This session store does not work with FastBoot. In order to use Ember Simple Auth with FastBoot, configure the CookieStore as the application's session store.
Methods
Overrides: clear
of BaseStore
.
Clears the store by deleting the
key from
localStorage
if that is available or by deleting the cookie if it is not.
Returns
→ Ember.RSVP.Promise
A promise that resolves when the store has been cleared successfully and rejects otherwise.
Overrides: persist
of BaseStore
.
Persists the data
in the localStorage
if it is available or in a cookie
if it is not.
Arguments
-
data
:Object
-
The data to persist
Returns
→ Ember.RSVP.Promise
A promise that resolves when the data has successfully been persisted and rejects otherwise.
Overrides: restore
of BaseStore
.
Returns all data currently stored in the localStorage
if that is
available - or if it is not, in the cookie - as a plain object.
Returns
→ Ember.RSVP.Promise
A promise that resolves with the data currently persisted in the store when the data has been restored successfully and rejects otherwise.
Properties
Default: null
The domain to use for the cookie if localStorage
is not available, e.g.,
"example.com", ".example.com" (which includes all subdomains) or
"subdomain.example.com". If not explicitly set, the cookie domain defaults
to the domain the session was authenticated on.
Events
sessionDataUpdated
Inherited from: sessionDataUpdated
of BaseStore
.
Arguments
-
data
:Object
- The updated session data