Skip to content

Commit

Permalink
Merge pull request #251 from GluuFederation/admin-ui-issue-193
Browse files Browse the repository at this point in the history
feat(redux store): update deprecated createStore
  • Loading branch information
duttarnab authored Jun 8, 2022
2 parents 9de53ad + 0da47c8 commit 759e3db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions admin-ui/app/components/App/AppMain.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import { Provider } from 'react-redux'
import { configureStore } from 'Redux/store'
import { configStore } from 'Redux/store'
import { PersistGate } from 'redux-persist/integration/react'
import AuthenticatedRouteSelector from './AuthenticatedRouteSelector'
const basePath = process.env.BASE_PATH || '/admin'

const AppMain = () => {
const { store, persistor } = configureStore()
const { store, persistor } = configStore()
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
Expand Down
14 changes: 7 additions & 7 deletions admin-ui/app/redux/store/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import { combineReducers } from 'redux'
import { configureStore } from '@reduxjs/toolkit'
import createSagaMiddleware from 'redux-saga'
import appReducers from '../reducers'
import RootSaga from '../sagas'
Expand All @@ -10,7 +11,6 @@ import process from 'Plugins/PluginReducersResolver'
// create the saga middleware
const sagaMiddleware = createSagaMiddleware()
const middlewares = [sagaMiddleware]
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const persistConfig = {
key: 'root',
storage,
Expand All @@ -30,12 +30,12 @@ const reducers = combine(reducerRegistry.getReducers())
process()
const persistedReducer = persistReducer(persistConfig, reducers)

export function configureStore(initialState) {
const store = createStore(
persistedReducer,
export function configStore(initialState) {
const store = configureStore({
middleware: middlewares,
reducer: persistedReducer,
initialState,
composeEnhancer(applyMiddleware(...middlewares)),
)
})
const persistor = persistStore(store)
window.dsfaStore = store
reducerRegistry.setChangeListener((reds) => {
Expand Down
1 change: 1 addition & 0 deletions admin-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@miltonbo/dashboard-style-airframe": "^0.2.0",
"@reduxjs/toolkit": "^1.8.2",
"ag-grid-community": "^21.0.1",
"ag-grid-react": "^21.0.1",
"axios": "^0.27.2",
Expand Down

0 comments on commit 759e3db

Please sign in to comment.