-
Notifications
You must be signed in to change notification settings - Fork 5
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 #23 from kouhin/feature/simplify_action_matching
Simplify souce code
- Loading branch information
Showing
9 changed files
with
66 additions
and
139 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,16 +1,14 @@ | ||
import Debug from 'debug'; | ||
import { loadRequest } from './action'; | ||
import { isAction } from './utils'; | ||
|
||
const debug = new Debug('redux-dataloader:load'); | ||
export const DATALOADER_ACTION_ID = () => {}; | ||
|
||
export default function load(action) { | ||
if (!isAction(action)) { | ||
throw new Error('action must be object', action); | ||
} | ||
if (debug.enabled) { | ||
debug('load() an action = ', action); | ||
debug('A Promise with a wrapped action is returned', loadRequest(action)); | ||
} | ||
return Promise.resolve(loadRequest(action)); | ||
const asyncAction = Promise.resolve(loadRequest(action)); | ||
// eslint-disable-next-line no-underscore-dangle | ||
asyncAction._id = DATALOADER_ACTION_ID; | ||
return asyncAction; | ||
} |
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
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
Oops, something went wrong.