Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
8a3e6155
Commit
8a3e6155
authored
Jun 23, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate helper for creating the default redux store for www pages
parent
b3795c94
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
src/lib/configure-store.js
src/lib/configure-store.js
+26
-0
src/lib/render.jsx
src/lib/render.jsx
+2
-19
No files found.
src/lib/configure-store.js
0 → 100644
View file @
8a3e6155
const
redux
=
require
(
'
redux
'
);
const
thunk
=
require
(
'
redux-thunk
'
).
default
;
const
reducer
=
require
(
'
../redux/reducer.js
'
);
const
configureStore
=
(
reducers
,
initialState
,
enhancer
)
=>
{
const
allReducers
=
reducer
(
reducers
);
const
composeEnhancers
=
window
.
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
||
redux
.
compose
;
const
enhancers
=
enhancer
?
composeEnhancers
(
redux
.
applyMiddleware
(
thunk
),
enhancer
)
:
composeEnhancers
(
redux
.
applyMiddleware
(
thunk
)
);
const
store
=
redux
.
createStore
(
allReducers
,
initialState
||
{},
enhancers
);
return
store
;
};
module
.
exports
=
configureStore
;
src/lib/render.jsx
View file @
8a3e6155
const
redux
=
require
(
'
redux
'
);
const
thunk
=
require
(
'
redux-thunk
'
).
default
;
// JSX syntax transforms to React.createElement
// JSX syntax transforms to React.createElement
const
React
=
require
(
'
react
'
);
// eslint-disable-line
const
React
=
require
(
'
react
'
);
// eslint-disable-line
const
ReactDOM
=
require
(
'
react-dom
'
);
const
ReactDOM
=
require
(
'
react-dom
'
);
...
@@ -8,7 +6,7 @@ const StoreProvider = require('react-redux').Provider;
...
@@ -8,7 +6,7 @@ const StoreProvider = require('react-redux').Provider;
const
IntlProvider
=
require
(
'
./intl.jsx
'
).
IntlProvider
;
const
IntlProvider
=
require
(
'
./intl.jsx
'
).
IntlProvider
;
const
permissionsActions
=
require
(
'
../redux/permissions.js
'
);
const
permissionsActions
=
require
(
'
../redux/permissions.js
'
);
const
sessionActions
=
require
(
'
../redux/session.js
'
);
const
sessionActions
=
require
(
'
../redux/session.js
'
);
const
reducer
=
require
(
'
../redux/reducer
.js
'
);
const
configureStore
=
require
(
'
./configure-store
.js
'
);
require
(
'
../main.scss
'
);
require
(
'
../main.scss
'
);
...
@@ -36,22 +34,7 @@ const render = (jsx, element, reducers, initialState, enhancer) => {
...
@@ -36,22 +34,7 @@ const render = (jsx, element, reducers, initialState, enhancer) => {
messages
=
window
.
_messages
[
locale
];
messages
=
window
.
_messages
[
locale
];
}
}
const
allReducers
=
reducer
(
reducers
);
const
store
=
configureStore
(
reducers
,
initialState
,
enhancer
);
const
composeEnhancers
=
window
.
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
||
redux
.
compose
;
const
enhancers
=
enhancer
?
composeEnhancers
(
redux
.
applyMiddleware
(
thunk
),
enhancer
)
:
composeEnhancers
(
redux
.
applyMiddleware
(
thunk
)
);
const
store
=
redux
.
createStore
(
allReducers
,
initialState
||
{},
enhancers
);
// Render view component
// Render view component
ReactDOM
.
render
(
ReactDOM
.
render
(
...
...
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