From 6cf7b931d86a93739a02a1db2d8f687dd1124b87 Mon Sep 17 00:00:00 2001 From: Ismail <msiamil.official@gmail.com> Date: Wed, 19 Aug 2020 13:49:43 +0500 Subject: [PATCH] install thunk as a middleware for async calls from DB --- employeemanagement/package-lock.json | 5 +++++ employeemanagement/package.json | 3 ++- employeemanagement/src/index.js | 5 +++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/employeemanagement/package-lock.json b/employeemanagement/package-lock.json index a583e5e..13a3175 100644 --- a/employeemanagement/package-lock.json +++ b/employeemanagement/package-lock.json @@ -10765,6 +10765,11 @@ "symbol-observable": "^1.2.0" } }, + "redux-thunk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.3.0.tgz", + "integrity": "sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==" + }, "regenerate": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.1.tgz", diff --git a/employeemanagement/package.json b/employeemanagement/package.json index 6b1d719..dd2bc7b 100644 --- a/employeemanagement/package.json +++ b/employeemanagement/package.json @@ -11,7 +11,8 @@ "react-redux": "^7.2.1", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3", - "redux": "^4.0.5" + "redux": "^4.0.5", + "redux-thunk": "^2.3.0" }, "scripts": { "start": "react-scripts start", diff --git a/employeemanagement/src/index.js b/employeemanagement/src/index.js index b803087..9c95988 100644 --- a/employeemanagement/src/index.js +++ b/employeemanagement/src/index.js @@ -3,11 +3,12 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; -import { createStore } from 'redux'; +import { createStore, applyMiddleware } from 'redux'; import authReducer from './store/reducers/authReducer'; import { Provider } from 'react-redux'; +import thunk from 'redux-thunk'; -const store = createStore(authReducer); +const store = createStore(authReducer, applyMiddleware(thunk)); ReactDOM.render( <React.StrictMode> -- GitLab