How to use the react-redux-loading-bar.loadingBarMiddleware function in react-redux-loading-bar

To help you get started, we’ve selected a few react-redux-loading-bar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mironov / react-redux-loading-bar / src / store.js View on Github external
import promiseMiddleware from 'redux-promise-middleware'
import { createLogger } from 'redux-logger'
import {
  createStore,
  applyMiddleware,
  compose,
} from 'redux'
import { loadingBarMiddleware } from 'react-redux-loading-bar'

import rootReducer from './reducer'

const createStoreWithMiddleware = compose(
  applyMiddleware(
    thunkMiddleware, // lets us dispatch() functions
    promiseMiddleware(), // resolves promises
    loadingBarMiddleware(), // manages loading bar
    createLogger(), // log actions in console
  ),
)(createStore)

const store = createStoreWithMiddleware(rootReducer)

export default store
github JimmyLv / nobackend.website / src / react / redux / store / index.js View on Github external
}
    }
  // }
  // const state = JSON.parse(stateString)
  // delete state.loadingBar // fixed loading bar always display issue
  // return state
}
/*eslint-enable */

const store = createStore(
  reducers,
  getInitialState(),
  compose(
    applyMiddleware(
      routerMiddleware(hashHistory),
      loadingBarMiddleware(),
      thunkMiddleware,
      createLogger()
    ),
    window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument()
  )
)

// store.dispatch(fetchArticleSummary())
// store.dispatch(fetchMusicList())

export default store
github containerum / ui / src / configureStore.js View on Github external
export default (history: Object, initialState: Object = {}): Store => {
  // create the saga middleware
  const sagaMiddleware = createSagaMiddleware();
  const middlewares = [
    thunk.withExtraArgument(axios),
    routerMiddleware(history),
    sagaMiddleware
  ];
  const composeEnhancers =
    (typeof window === 'object' &&
      window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
    compose;
  const enhancers = composeEnhancers(
    applyMiddleware(
      ...middlewares,
      loadingBarMiddleware({
        promiseTypeSuffixes: ['REQUESTING', 'SUCCESS', 'FAILURE']
      })
    )
    // Other store enhancers if any
  );
  const store = createStore(rootReducer, initialState, enhancers);

  // then run the saga
  sagaMiddleware.run(rootSaga);

  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('./reducers', () => {
      try {
        const nextReducer = require('./reducers').default;
github interledger-deprecated / ilp-kit / src / redux / store.js View on Github external
export default function createStore (history, client, data) {
  // Sync dispatched route actions to the history
  const reduxRouterMiddleware = syncHistory(history)

  const middleware = [createMiddleware(client), reduxRouterMiddleware]

  // Leave the __CLIENT__ check until below issue is resolved
  // https://github.com/mironov/react-redux-loading-bar/issues/30
  if (__CLIENT__) {
    middleware.push(loadingBarMiddleware({
      promiseTypeSuffixes: ['PENDING', 'SUCCESS', 'FAIL']
    }))
  }

  let finalCreateStore
  if (__DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) {
    const { persistState } = require('redux-devtools')
    const DevTools = require('../containers/DevTools/DevTools')
    finalCreateStore = compose(
      applyMiddleware(...middleware),
      window.devToolsExtension ? window.devToolsExtension() : DevTools.instrument(),
      persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
    )(_createStore)
  } else {
    finalCreateStore = applyMiddleware(...middleware)(_createStore)
  }
github briancappello / flask-react-spa / frontend / app / configureStore.js View on Github external
export default function configureStore(initialState, history) {
  const middlewares = [
    sagaMiddleware,
    routerMiddleware(history),
    loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'FULFILL'] }),
    flashClearMiddleware,
  ]

  const enhancers = [
    applyMiddleware(...middlewares),
  ]

  const composeEnhancers =
    isDev && hasWindowObject && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
      ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
      : compose

  const store = createStore(
    createReducer(),
    initialState,
    composeEnhancers(...enhancers)
github PulseTile / PulseTile-React-Core / src / index.js View on Github external
advancedSearchPatient: {},
  clinicalQuerySearch: {},
  patientsSummaries: {},
  isSidebarVisible: false,
  profileAppPreferences: {},
  patientsInfo: {},
  requestError: {},
};

//create store and enhance with middleware
let store;
if (process.env.NODE_ENV === 'production') {
  store = createStore(rootReducer, initialState, applyMiddleware(epicMiddleware, routerMiddlewareInstance, loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAILURE'] })));
} else {
  const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
  store = createStore(rootReducer, initialState, composeEnhancers(applyMiddleware(epicMiddleware, routerMiddlewareInstance, loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAILURE'] }))));
}

//initialisation
store.dispatch(initialiseStart());

render(
  //Provider allows us to receive data from store of our app (by connect function)
  
    
      
        
      
    
  ,
  document.getElementById('app-root'),
);
github the-bionic / playback / src / configureStore.js View on Github external
const getMiddleware = () =>
  applyMiddleware(
    myRouterMiddleware,
    sagaMiddleware,
    thunk,
    loadingBarMiddleware()
  );
github SuperblocksHQ / ethereum-studio / packages / dashboard / src / store / index.js View on Github external
const configureMiddleware = () => {
    const rootEpic = combineEpics(...epics);
    const epicMiddleware = createEpicMiddleware({
        dependencies: {
        }
    });
    const loadingBarMid = loadingBarMiddleware({
        promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'],
    });

    const middleware = [
        thunk,
        epicMiddleware,
        loadingBarMid
    ];

    return { middleware, epicMiddleware, rootEpic };
}
github CodeChain-io / codechain-explorer / src / redux / store.ts View on Github external
import { loadingBarMiddleware } from "react-redux-loading-bar";
import { applyMiddleware, createStore } from "redux";
import { rootReducer } from "./actions";

export const store = createStore(
    rootReducer,
    applyMiddleware(
        loadingBarMiddleware({
            scope: "searchBar"
        })
    )
);
github SuperblocksHQ / ethereum-studio / packages / editor / src / store / index.js View on Github external
const configureMiddleware = (router) => {
    const rootEpic = combineEpics(...epics);
    const epicMiddleware = createEpicMiddleware({
        dependencies: {
            router: router
        }
    });

    const loadingBarMid = loadingBarMiddleware({
        promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'],
    });

    const middleware = [
        thunk,
        epicMiddleware,
        loadingBarMid
    ];

    return { middleware, epicMiddleware, rootEpic };
}

react-redux-loading-bar

Simple Loading Bar for Redux and React

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis