diff --git a/src/components/Mentor.js b/src/components/Mentor.js
index c668dae..a060569 100644
--- a/src/components/Mentor.js
+++ b/src/components/Mentor.js
@@ -1,4 +1,5 @@
import React, { Component } from "react";
+import {connect} from 'react-redux';
// import Header from "./components/Header";
import { data, getProduct } from "../response/response";
import MentorList from "../components/MentorList";
@@ -160,4 +161,8 @@ class Mentor extends Component {
}
}
-export default Mentor;
+const mapStateToProps = (state)=>({
+ search:state.search.target
+})
+
+export default connect(mapStateToProps,null)(Mentor);
diff --git a/src/reducers/index.js b/src/reducers/index.js
new file mode 100644
index 0000000..334f479
--- /dev/null
+++ b/src/reducers/index.js
@@ -0,0 +1,10 @@
+import products from './products';
+import user from './user';
+import search from './search';
+
+
+export {
+ products,
+ user,
+ search
+};
\ No newline at end of file
diff --git a/src/reducers/products.js b/src/reducers/products.js
new file mode 100644
index 0000000..c09f26a
--- /dev/null
+++ b/src/reducers/products.js
@@ -0,0 +1,39 @@
+
+const defaultState={
+ data:[],
+ loading:false,
+ error:null
+}
+
+ const products=(state=defaultState,action)=>{
+ const {type} = action;
+ switch (type){
+ case 'FETCHING_PRODUCTS':
+ return {
+ data:[],
+ loading:true,
+ error:null
+ }
+ break;
+ case 'SET_PRODUCTS':
+ const {data} = action;
+ return {
+ data,
+ loading:false,
+ error:null
+ }
+ break;
+ case 'FETCH_PRODUCTS_FAIL':
+ const {error} = action;
+ return {
+ data:[],
+ loading:false,
+ error
+ }
+ break;
+ default:
+
+ return state;
+ }
+}
+export default products;
\ No newline at end of file
diff --git a/src/reducers/search.js b/src/reducers/search.js
new file mode 100644
index 0000000..fe2f6b4
--- /dev/null
+++ b/src/reducers/search.js
@@ -0,0 +1,31 @@
+const defaultState = {
+ target:'',
+ data:[],
+ isSearching:false
+}
+
+const search = (state=defaultState,action)=>{
+ const {type} = action;
+ switch(type){
+ case "PERFORMING_SEARCH":
+ return {
+ target:action.target,
+ data:[],
+ isSearching:true
+ }
+ break;
+ case "SET_DATA":
+ return {
+ target:action.target,
+ data:action.data,
+ isSearching:false
+ }
+ break;
+ default:
+ return state;
+
+
+ }
+}
+
+export default search;
\ No newline at end of file
diff --git a/src/reducers/user.js b/src/reducers/user.js
new file mode 100644
index 0000000..72e17b3
--- /dev/null
+++ b/src/reducers/user.js
@@ -0,0 +1,33 @@
+const defaultState={
+ data:{},
+ isAuthenticated:false,
+ error:false
+};
+
+
+const user = (state=defaultState,action)=>{
+ const {type}=action;
+
+ switch(type){
+ case 'USER_CURRENT_SET':
+ return {
+ isAuthenticated: true,
+ user: action.user
+ }
+ break;
+ case 'FAIL_LOGIN':
+ return {
+ isAuthenticated:false,
+ error:true,
+ user:{}
+
+ }
+ break;
+
+
+ default:
+ return state
+ }
+};
+
+export default user;
diff --git a/src/store.js b/src/store.js
new file mode 100644
index 0000000..7c96afc
--- /dev/null
+++ b/src/store.js
@@ -0,0 +1,23 @@
+import {createStore,applyMiddleware,compose,combineReducers} from 'redux';
+import thunk from 'redux-thunk';
+import {products,user,search} from './reducers';
+
+
+function logger({getState}) {
+ return next => action => {
+ console.log('will dispatch', action)
+
+ // Call the next dispatch method in the middleware chain.
+ const returnValue = next(action)
+
+ console.log('state after dispatch', getState())
+ // This will likely be the action itself, unless
+ // a middleware further in chain changed it.
+ return returnValue
+ }
+}
+
+const store = createStore(combineReducers({products,user,search}),
+ compose(applyMiddleware(thunk,logger)));
+
+export default store;