From 9c396976bb42a9d41407358ce1a1d37242230f21 Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Fri, 27 May 2022 12:50:13 -0500 Subject: Add redux, dispatch and etiquetas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - estetica de etiquetas (ok) - add message, pedido Reducer - add dispatch en Componentes con connect - add api reducer que obtienen el JSON todo ok #TODO - FIX logica de añadiir - FIX axios y dispatch fuera de un componente --- front/odiparpack/app/redux/configureStore.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'front/odiparpack/app/redux/configureStore.js') diff --git a/front/odiparpack/app/redux/configureStore.js b/front/odiparpack/app/redux/configureStore.js index 49a6b7b..80c84c0 100644 --- a/front/odiparpack/app/redux/configureStore.js +++ b/front/odiparpack/app/redux/configureStore.js @@ -7,6 +7,7 @@ import { fromJS } from 'immutable'; import { routerMiddleware } from 'connected-react-router/immutable'; import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; +import thunk from 'redux-thunk'; const sagaMiddleware = createSagaMiddleware(); @@ -14,7 +15,7 @@ export default function configureStore(initialState = {}, history) { // Create the store with two middlewares // 1. sagaMiddleware: Makes redux-sagas work // 2. routerMiddleware: Syncs the location/URL path to the state - const middlewares = [sagaMiddleware, routerMiddleware(history)]; + const middlewares = [thunk,sagaMiddleware, routerMiddleware(history)]; const enhancers = [applyMiddleware(...middlewares)]; @@ -29,11 +30,12 @@ export default function configureStore(initialState = {}, history) { shouldHotReload: false, }) : compose; + /* eslint-enable */ const store = createStore( createReducer(), fromJS(initialState), - composeEnhancers(...enhancers), + composeEnhancers(...enhancers) ); // Extensions -- cgit v1.2.3 From 32fb17de8f78317b165b6f269a8bab2d4e852d0d Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Mon, 30 May 2022 20:08:04 -0500 Subject: Fix axios and add new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FIX logica de añadiir (ok) - FIX axios y dispatch fuera de un componente (ok) - Cambiar las notificaciones --- front/odiparpack/app/redux/configureStore.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'front/odiparpack/app/redux/configureStore.js') diff --git a/front/odiparpack/app/redux/configureStore.js b/front/odiparpack/app/redux/configureStore.js index 80c84c0..767af03 100644 --- a/front/odiparpack/app/redux/configureStore.js +++ b/front/odiparpack/app/redux/configureStore.js @@ -8,14 +8,15 @@ import { routerMiddleware } from 'connected-react-router/immutable'; import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; import thunk from 'redux-thunk'; +import { composeWithDevTools } from "redux-devtools-extension"; const sagaMiddleware = createSagaMiddleware(); -export default function configureStore(initialState = {}, history) { +export function configureStore(initialState = {}, history) { // Create the store with two middlewares // 1. sagaMiddleware: Makes redux-sagas work // 2. routerMiddleware: Syncs the location/URL path to the state - const middlewares = [thunk,sagaMiddleware, routerMiddleware(history)]; + const middlewares = [thunk, routerMiddleware(history)]; const enhancers = [applyMiddleware(...middlewares)]; @@ -35,13 +36,13 @@ export default function configureStore(initialState = {}, history) { const store = createStore( createReducer(), fromJS(initialState), - composeEnhancers(...enhancers) + composeWithDevTools(applyMiddleware(thunk)) ); // Extensions - store.runSaga = sagaMiddleware.run; + //store.runSaga = sagaMiddleware.run; store.injectedReducers = {}; // Reducer registry - store.injectedSagas = {}; // Saga registry + //store.injectedSagas = {}; // Saga registry // Make reducers hot reloadable, see http://mxs.is/googmo /* istanbul ignore next */ @@ -53,3 +54,12 @@ export default function configureStore(initialState = {}, history) { return store; } + +export function confStore (){ + const store = createStore( + createReducer(), + composeWithDevTools(applyMiddleware(thunk)) + ); + store.injectedReducers = {}; + return store; +} -- cgit v1.2.3