-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move epic stuff to observable index, add tests
- Loading branch information
1 parent
377ae83
commit f529d6f
Showing
7 changed files
with
33 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
import { combineEpics } from 'redux-observable'; | ||
|
||
import processResources from '../processResources'; | ||
import generateEpic from './generateEpic'; | ||
import fromResource from './fromResource'; | ||
|
||
export default function incrudable(resources, config) { | ||
return processResources(generateEpic, resources, config); | ||
const sources = processResources(generateEpic, resources, config); | ||
|
||
const epics = Object.keys(sources).reduce((acc, sourceName) => { | ||
const tasks = sources[sourceName]; | ||
const epics = Object.keys(tasks).map(taskName => tasks[taskName].epic); | ||
tasks.epic = combineEpics(...epics); | ||
|
||
return acc.concat(tasks.epic); | ||
}, []); | ||
console.log('epics', epics); | ||
|
||
sources.epic = combineEpics(...epics); | ||
|
||
return sources; | ||
} | ||
|
||
incrudable.fromResource = fromResource; |
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,17 +1,9 @@ | ||
import { combineEpics } from 'redux-observable'; | ||
|
||
import processResources from '../processResources'; | ||
import generateThunk from './generateThunk'; | ||
import fromResource from './fromResource'; | ||
|
||
|
||
export default function incrudable(resources, config) { | ||
const sources = processResources(generateThunk, resources, config); | ||
|
||
const epics = Object.keys(sources).map(resourceName => sources[resourceName].epic); | ||
sources.epic = combineEpics(...epics); | ||
|
||
return sources; | ||
return processResources(generateThunk, resources, config); | ||
} | ||
|
||
incrudable.fromResource = fromResource; |
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