Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
f9fedaeb
Commit
f9fedaeb
authored
Feb 17, 2019
by
Timon Borter
Committed by
Tim Neutkens
Feb 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
recreate stdChannel (or saga middleware). (#6330)
parent
9f2eb85d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
store.js
examples/with-redux-saga/store.js
+3
-7
No files found.
examples/with-redux-saga/store.js
View file @
f9fedaeb
import
{
createStore
,
applyMiddlewa
re
}
from
'redux'
import
{
applyMiddleware
,
createSto
re
}
from
'redux'
import
createSagaMiddleware
from
'redux-saga'
import
createSagaMiddleware
from
'redux-saga'
import
rootReducer
,
{
exampleInitialState
}
from
'./reducer'
import
rootReducer
,
{
exampleInitialState
}
from
'./reducer'
import
rootSaga
from
'./saga'
import
rootSaga
from
'./saga'
const
sagaMiddleware
=
createSagaMiddleware
()
const
bindMiddleware
=
middleware
=>
{
const
bindMiddleware
=
middleware
=>
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
const
{
composeWithDevTools
}
=
require
(
'redux-devtools-extension'
)
const
{
composeWithDevTools
}
=
require
(
'redux-devtools-extension'
)
...
@@ -15,17 +13,15 @@ const bindMiddleware = middleware => {
...
@@ -15,17 +13,15 @@ const bindMiddleware = middleware => {
}
}
function
configureStore
(
initialState
=
exampleInitialState
)
{
function
configureStore
(
initialState
=
exampleInitialState
)
{
const
sagaMiddleware
=
createSagaMiddleware
()
const
store
=
createStore
(
const
store
=
createStore
(
rootReducer
,
rootReducer
,
initialState
,
initialState
,
bindMiddleware
([
sagaMiddleware
])
bindMiddleware
([
sagaMiddleware
])
)
)
store
.
runSagaTask
=
()
=>
{
store
.
sagaTask
=
sagaMiddleware
.
run
(
rootSaga
)
store
.
sagaTask
=
sagaMiddleware
.
run
(
rootSaga
)
}
store
.
runSagaTask
()
return
store
return
store
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment