mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
- Data table sticky header.
- Mini sidebar toggle. - Refactor withDashboard and withDashboardActions.
This commit is contained in:
@@ -3,10 +3,12 @@ import thunkMiddleware from 'redux-thunk';
|
||||
import monitorReducerEnhancer from 'store/enhancers/monitorReducer';
|
||||
import loggerMiddleware from 'middleware/logger'
|
||||
import rootReducer from 'store/reducers';
|
||||
import { loadState, saveState } from 'store/localStorage';
|
||||
import persistState from 'redux-localstorage'
|
||||
|
||||
const persistPaths = ['dashboard', 'authentication'];
|
||||
|
||||
const createStore = (initialState = {
|
||||
...loadState(),
|
||||
// ...loadState(),
|
||||
}) => {
|
||||
/**
|
||||
|--------------------------------------------------
|
||||
@@ -25,6 +27,7 @@ const createStore = (initialState = {
|
||||
*/
|
||||
const enhancers = [
|
||||
monitorReducerEnhancer,
|
||||
persistState(persistPaths, { key: 'bigcapital' }),
|
||||
];
|
||||
let composeEnhancers = compose;
|
||||
|
||||
@@ -45,12 +48,6 @@ const createStore = (initialState = {
|
||||
composeEnhancers(applyMiddleware(...middleware), ...enhancers)
|
||||
);
|
||||
store.asyncReducers = {};
|
||||
|
||||
store.subscribe(() => {
|
||||
saveState({
|
||||
authentication: store.getState().authentication,
|
||||
});
|
||||
});
|
||||
return store;
|
||||
};
|
||||
export default createStore();
|
||||
|
||||
@@ -5,6 +5,7 @@ const initialState = {
|
||||
pageTitle: '',
|
||||
pageSubtitle: 'Hello World',
|
||||
preferencesPageTitle: '',
|
||||
sidebarExpended: true,
|
||||
dialogs: {},
|
||||
topbarEditViewId: null,
|
||||
requestsLoading: 0,
|
||||
@@ -52,6 +53,10 @@ export default createReducer(initialState, {
|
||||
[t.SET_DASHBOARD_REQUEST_COMPLETED]: (state, action) => {
|
||||
const requestsLoading = state.requestsLoading - 1;
|
||||
state.requestsLoading = Math.max(requestsLoading, 0);
|
||||
},
|
||||
|
||||
[t.SIDEBAR_EXPEND_TOGGLE]: (state) => {
|
||||
state.sidebarExpended = !state.sidebarExpended;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -11,4 +11,5 @@ export default {
|
||||
SET_TOPBAR_EDIT_VIEW: 'SET_TOPBAR_EDIT_VIEW',
|
||||
SET_DASHBOARD_REQUEST_LOADING: 'SET_DASHBOARD_REQUEST_LOADING',
|
||||
SET_DASHBOARD_REQUEST_COMPLETED: 'SET_DASHBOARD_REQUEST_COMPLETED',
|
||||
SIDEBAR_EXPEND_TOGGLE: 'SIDEBAR_EXPEND_TOGGLE',
|
||||
};
|
||||
@@ -36,5 +36,4 @@ export default {
|
||||
...search,
|
||||
...register,
|
||||
...exchangeRate,
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user