-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): handle async actions with 'redux-thunk'
add 'movies' reducer and get the movies asynchronously
- Loading branch information
1 parent
422a6c3
commit 0fedc21
Showing
8 changed files
with
76 additions
and
23 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @module reducers/movies | ||
*/ | ||
|
||
import { SET_MOVIES } from '../constants/ActionTypes'; | ||
|
||
/** | ||
* | ||
* @param state | ||
* @param action | ||
* @return {*} | ||
*/ | ||
export default function movies(state = [], action) { | ||
switch (action.type) { | ||
|
||
case SET_MOVIES: | ||
|
||
return action.movies; | ||
|
||
default: | ||
return state; | ||
} | ||
|
||
} |
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,5 +1,6 @@ | ||
import { createStore } from 'redux'; | ||
import { createStore, applyMiddleware } from 'redux'; | ||
import thunk from 'redux-thunk'; | ||
|
||
import reducer from './reducers'; | ||
|
||
export default createStore(reducer); | ||
export default createStore(reducer, applyMiddleware(thunk)); |
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 |
---|---|---|
|
@@ -865,7 +865,7 @@ [email protected], babel-plugin-transform-regenerator@^6 | |
dependencies: | ||
regenerator-transform "^0.10.0" | ||
|
||
babel-plugin-transform-runtime@^6.23.0: | ||
[email protected]: | ||
version "6.23.0" | ||
resolved "https://registry.yarnpkg.com/babel-plugin-transform-runtime/-/babel-plugin-transform-runtime-6.23.0.tgz#88490d446502ea9b8e7efb0fe09ec4d99479b1ee" | ||
dependencies: | ||
|
@@ -1805,7 +1805,7 @@ copy-props@^1.4.1: | |
each-props "^1.2.1" | ||
is-plain-object "^2.0.1" | ||
|
||
copy-webpack-plugin@^4.3.1: | ||
[email protected]: | ||
version "4.3.1" | ||
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.3.1.tgz#19ba6370bf6f8e263cbd66185a2b79f2321a9302" | ||
dependencies: | ||
|
@@ -6941,6 +6941,10 @@ reduce-function-call@^1.0.1: | |
dependencies: | ||
balanced-match "^0.4.2" | ||
|
||
redux-thunk@^2.2.0: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/redux-thunk/-/redux-thunk-2.2.0.tgz#e615a16e16b47a19a515766133d1e3e99b7852e5" | ||
|
||
[email protected]: | ||
version "3.7.2" | ||
resolved "https://registry.yarnpkg.com/redux/-/redux-3.7.2.tgz#06b73123215901d25d065be342eb026bc1c8537b" | ||
|