-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2312 from BobrImperator/2308-adaptive-store-DI
[2308] Refactor Adaptive store to use DI
- Loading branch information
Showing
9 changed files
with
260 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 5 additions & 17 deletions
22
packages/ember-simple-auth/tests/helpers/create-adaptive-store.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,13 @@ | ||
import Adaptive from 'ember-simple-auth/session-stores/adaptive'; | ||
import createCookieStore from './create-cookie-store'; | ||
import { merge, assign as emberAssign } from '@ember/polyfills'; | ||
|
||
const assign = emberAssign || merge; | ||
|
||
export default function createAdaptiveStore( | ||
cookiesService, | ||
options = {}, | ||
props = {} | ||
owner | ||
) { | ||
let cookieStore = createCookieStore( | ||
cookiesService, | ||
assign({}, options, { _isFastboot: false }) | ||
); | ||
props._createStore = function() { | ||
cookieStore.on('sessionDataUpdated', data => { | ||
this.trigger('sessionDataUpdated', data); | ||
}); | ||
|
||
return cookieStore; | ||
}; | ||
owner.register('session-store:adaptive', Adaptive.extend(Object.assign({ | ||
_isLocalStorageAvailable: false, | ||
}, options))); | ||
|
||
return Adaptive.extend(props).create(options); | ||
return owner.lookup('session-store:adaptive'); | ||
} |
7 changes: 0 additions & 7 deletions
7
packages/ember-simple-auth/tests/helpers/create-cookie-store.js
This file was deleted.
Oops, something went wrong.
129 changes: 66 additions & 63 deletions
129
packages/ember-simple-auth/tests/unit/session-stores/adaptive-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.