Skip to content

Commit 759e3db

Browse files
authored
Merge pull request #251 from GluuFederation/admin-ui-issue-193
feat(redux store): update deprecated createStore
2 parents 9de53ad + 0da47c8 commit 759e3db

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

admin-ui/app/components/App/AppMain.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react'
22
import { BrowserRouter as Router } from 'react-router-dom'
33
import { Provider } from 'react-redux'
4-
import { configureStore } from 'Redux/store'
4+
import { configStore } from 'Redux/store'
55
import { PersistGate } from 'redux-persist/integration/react'
66
import AuthenticatedRouteSelector from './AuthenticatedRouteSelector'
77
const basePath = process.env.BASE_PATH || '/admin'
88

99
const AppMain = () => {
10-
const { store, persistor } = configureStore()
10+
const { store, persistor } = configStore()
1111
return (
1212
<Provider store={store}>
1313
<PersistGate loading={null} persistor={persistor}>

admin-ui/app/redux/store/index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
1+
import { combineReducers } from 'redux'
2+
import { configureStore } from '@reduxjs/toolkit'
23
import createSagaMiddleware from 'redux-saga'
34
import appReducers from '../reducers'
45
import RootSaga from '../sagas'
@@ -10,7 +11,6 @@ import process from 'Plugins/PluginReducersResolver'
1011
// create the saga middleware
1112
const sagaMiddleware = createSagaMiddleware()
1213
const middlewares = [sagaMiddleware]
13-
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
1414
const persistConfig = {
1515
key: 'root',
1616
storage,
@@ -30,12 +30,12 @@ const reducers = combine(reducerRegistry.getReducers())
3030
process()
3131
const persistedReducer = persistReducer(persistConfig, reducers)
3232

33-
export function configureStore(initialState) {
34-
const store = createStore(
35-
persistedReducer,
33+
export function configStore(initialState) {
34+
const store = configureStore({
35+
middleware: middlewares,
36+
reducer: persistedReducer,
3637
initialState,
37-
composeEnhancer(applyMiddleware(...middlewares)),
38-
)
38+
})
3939
const persistor = persistStore(store)
4040
window.dsfaStore = store
4141
reducerRegistry.setChangeListener((reds) => {

admin-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
"@material-ui/icons": "^4.11.2",
122122
"@material-ui/lab": "^4.0.0-alpha.60",
123123
"@miltonbo/dashboard-style-airframe": "^0.2.0",
124+
"@reduxjs/toolkit": "^1.8.2",
124125
"ag-grid-community": "^21.0.1",
125126
"ag-grid-react": "^21.0.1",
126127
"axios": "^0.27.2",

0 commit comments

Comments
 (0)