diff options
| author | mo khan <mo@mokhan.ca> | 2016-12-22 11:50:17 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-12-22 11:50:17 -0700 |
| commit | 8db8cbe7bab3afdd6d73191f2fde2838fe16849b (patch) | |
| tree | f8b2801a9cc4696afb7df1d5557d592d68f34408 | |
| parent | c46de15a5454f0083ade267b6cb949bbd63e2be5 (diff) | |
remove default parameter in constructor.
| -rw-r--r-- | app/boot/wire-up-components-into.js | 4 | ||||
| -rw-r--r-- | app/infrastructure/api.js | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/app/boot/wire-up-components-into.js b/app/boot/wire-up-components-into.js index 5624638..8b49108 100644 --- a/app/boot/wire-up-components-into.js +++ b/app/boot/wire-up-components-into.js @@ -19,8 +19,8 @@ export default class WireUpComponentsInto { }); }).asSingleton(); this.registry.register('applicationStorage', ApplicationStorage).asSingleton(); - this.registry.register('sessionsApi', () => new Api('/sessions')).asSingleton(); - this.registry.register('workoutsApi', () => new Api('/workouts')).asSingleton(); + this.registry.register('sessionsApi', (container) => new Api('/sessions', container.resolve('applicationStorage'))).asSingleton(); + this.registry.register('workoutsApi', (container) => new Api('/workouts', container.resolve('applicationStorage'))).asSingleton(); this.registerSubscribers(commands); this.registerSubscribers(queries); return this.registry; diff --git a/app/infrastructure/api.js b/app/infrastructure/api.js index fc7f69c..139545e 100644 --- a/app/infrastructure/api.js +++ b/app/infrastructure/api.js @@ -1,14 +1,13 @@ import Config from 'react-native-config'; -import ApplicationStorage from './application-storage'; export default class Api { - constructor(url, storage = new ApplicationStorage()) { + constructor(url, applicationStorage) { if (url.startsWith('http')) { this.url = url; } else { this.url = `${Config.API_HOST}/api${url}` } - this.storage = storage; + this.storage = applicationStorage; } get(success) { |
