mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 19:27:52 +01:00
Enable redux dev tools and refactor http requests
This commit is contained in:
7
app/javascript/helpers/buildRequestHeaders.ts
Normal file
7
app/javascript/helpers/buildRequestHeaders.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
const buildRequestHeaders = (authenticityToken: string) => ({
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': authenticityToken,
|
||||
});
|
||||
|
||||
export default buildRequestHeaders;
|
||||
@@ -1,19 +1,15 @@
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
// import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
|
||||
import rootReducer from '../reducers/rootReducer';
|
||||
|
||||
// const composeEnhancers = composeWithDevTools({
|
||||
// trace: true,
|
||||
// });
|
||||
|
||||
const createStoreHelper = () => (
|
||||
createStore(
|
||||
rootReducer,
|
||||
// composeEnhancers(
|
||||
applyMiddleware(thunkMiddleware)
|
||||
// )
|
||||
compose(
|
||||
applyMiddleware(thunkMiddleware),
|
||||
(window as any).__REDUX_DEVTOOLS_EXTENSION__ && (window as any).__REDUX_DEVTOOLS_EXTENSION__()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user