import LocalStorageStore from 'ember-simple-auth/session-stores/local-storage';

Session store that persists data in the browser's localStorage.

localStorage is not available in Safari when running in private mode. In general it is better to use the AdaptiveStore that automatically falls back to the CookieStore when localStorage is not available.

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

source public

clear( ) Ember.RSVP.Promise

Overrides: clear of BaseStore.

Clears the store by deleting the key from localStorage.

Returns

Ember.RSVP.Promise

A promise that resolves when the store has been cleared successfully and rejects otherwise.

source public

persist(data) Ember.RSVP.Promise

Overrides: persist of BaseStore.

Persists the data in the localStorage.

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.

source public

restore( ) Ember.RSVP.Promise

Overrides: restore of BaseStore.

Returns all data currently stored in the localStorage 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

source public

key: String

Default: 'ember_simple_auth-session'

The localStorage key the store persists data in.

Events

source

sessionDataUpdated

Inherited from: sessionDataUpdated of BaseStore.

Triggered when the session store's data changes due to an external event, e.g. from another tab or window of the same application. The session handles that event, passes the updated data to its authenticator's restore method and handles the result of that invocation accordingly.

Arguments

data: Object

The updated session data

Extends

BaseStore

Properties