2019-10-15 06:20:12 +02:00
|
|
|
import * as ACTIONS from 'constants/action_types';
|
2019-07-23 10:05:51 +02:00
|
|
|
import { persistStore, persistReducer } from 'redux-persist';
|
|
|
|
import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
|
2017-12-21 18:32:51 +01:00
|
|
|
import createCompressor from 'redux-persist-transform-compress';
|
2019-11-12 23:03:11 +01:00
|
|
|
import { createFilter, createBlacklistFilter } from 'redux-persist-transform-filter';
|
2017-12-21 18:32:51 +01:00
|
|
|
import localForage from 'localforage';
|
2019-04-04 23:05:23 +02:00
|
|
|
import { createStore, applyMiddleware, compose } from 'redux';
|
2017-12-21 18:32:51 +01:00
|
|
|
import thunk from 'redux-thunk';
|
2020-01-22 05:37:33 +01:00
|
|
|
import { createMemoryHistory, createBrowserHistory } from 'history';
|
2019-06-11 20:10:58 +02:00
|
|
|
import { routerMiddleware } from 'connected-react-router';
|
2019-04-04 23:05:23 +02:00
|
|
|
import createRootReducer from './reducers';
|
2020-09-04 17:02:30 +02:00
|
|
|
import { Lbry, buildSharedStateMiddleware, ACTIONS as LBRY_REDUX_ACTIONS } from 'lbry-redux';
|
2021-01-21 20:50:51 +01:00
|
|
|
import { doSyncLoop } from 'redux/actions/sync';
|
2020-09-04 17:02:30 +02:00
|
|
|
import { getAuthToken } from 'util/saved-passwords';
|
2020-02-12 05:59:30 +01:00
|
|
|
import { generateInitialUrl } from 'util/url';
|
2020-06-08 19:27:08 +02:00
|
|
|
import { X_LBRY_AUTH_TOKEN } from 'constants/token';
|
2017-04-07 07:15:22 +02:00
|
|
|
|
|
|
|
function isFunction(object) {
|
2017-12-21 18:32:51 +01:00
|
|
|
return typeof object === 'function';
|
2017-04-07 07:15:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function isNotFunction(object) {
|
2017-06-15 06:27:23 +02:00
|
|
|
return !isFunction(object);
|
2017-04-07 07:15:22 +02:00
|
|
|
}
|
|
|
|
|
2017-04-26 19:08:26 +02:00
|
|
|
function createBulkThunkMiddleware() {
|
2021-03-03 19:50:16 +01:00
|
|
|
return ({ dispatch, getState }) => (next) => (action) => {
|
2017-12-21 18:32:51 +01:00
|
|
|
if (action.type === 'BATCH_ACTIONS') {
|
2021-03-03 19:50:16 +01:00
|
|
|
action.actions.filter(isFunction).map((actionFn) => actionFn(dispatch, getState));
|
2017-06-15 06:27:23 +02:00
|
|
|
}
|
|
|
|
return next(action);
|
|
|
|
};
|
2017-04-26 19:08:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function enableBatching(reducer) {
|
2017-06-15 06:27:23 +02:00
|
|
|
return function batchingReducer(state, action) {
|
|
|
|
switch (action.type) {
|
2017-12-21 18:32:51 +01:00
|
|
|
case 'BATCH_ACTIONS':
|
|
|
|
return action.actions.filter(isNotFunction).reduce(batchingReducer, state);
|
2017-06-15 06:27:23 +02:00
|
|
|
default:
|
|
|
|
return reducer(state, action);
|
|
|
|
}
|
|
|
|
};
|
2017-04-26 19:08:26 +02:00
|
|
|
}
|
|
|
|
|
2018-07-31 20:07:45 +02:00
|
|
|
const contentFilter = createFilter('content', ['positions', 'history']);
|
2018-10-25 08:01:32 +02:00
|
|
|
const fileInfoFilter = createFilter('fileInfo', [
|
|
|
|
'fileListPublishedSort',
|
|
|
|
'fileListDownloadedSort',
|
|
|
|
'fileListSubscriptionSort',
|
|
|
|
]);
|
2020-02-19 07:31:40 +01:00
|
|
|
const appFilter = createFilter('app', [
|
|
|
|
'hasClickedComment',
|
|
|
|
'searchOptionsExpanded',
|
|
|
|
'volume',
|
|
|
|
'muted',
|
|
|
|
'allowAnalytics',
|
|
|
|
'welcomeVersion',
|
2020-09-04 22:11:28 +02:00
|
|
|
'interestedInYoutubeSync',
|
2020-11-09 18:22:38 +01:00
|
|
|
'splashAnimationEnabled',
|
2021-02-09 17:05:56 +01:00
|
|
|
'activeChannel',
|
2020-02-19 07:31:40 +01:00
|
|
|
]);
|
2021-06-25 00:06:08 +02:00
|
|
|
const claimsFilter = createFilter('claims', ['pendingById']);
|
2018-04-18 06:03:01 +02:00
|
|
|
// We only need to persist the receiveAddress for the wallet
|
|
|
|
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
2019-02-18 18:24:56 +01:00
|
|
|
const searchFilter = createFilter('search', ['options']);
|
2019-07-02 23:00:05 +02:00
|
|
|
const tagsFilter = createFilter('tags', ['followedTags']);
|
2019-10-15 06:20:12 +02:00
|
|
|
const subscriptionsFilter = createFilter('subscriptions', ['subscriptions']);
|
2019-08-02 17:11:31 +02:00
|
|
|
const blockedFilter = createFilter('blocked', ['blockedChannels']);
|
2021-04-04 09:10:55 +02:00
|
|
|
const coinSwapsFilter = createFilter('coinSwap', ['coinSwaps']);
|
2019-11-12 23:18:50 +01:00
|
|
|
const settingsFilter = createBlacklistFilter('settings', ['loadedLanguages', 'language']);
|
2021-06-25 00:06:08 +02:00
|
|
|
const collectionsFilter = createFilter('collections', ['builtin', 'saved', 'unpublished', 'edited', 'pending']);
|
2019-07-01 06:35:36 +02:00
|
|
|
const whiteListedReducers = [
|
2021-06-25 00:06:08 +02:00
|
|
|
'claims',
|
2019-10-24 20:07:48 +02:00
|
|
|
'fileInfo',
|
2019-07-01 06:35:36 +02:00
|
|
|
'publish',
|
|
|
|
'wallet',
|
2019-09-26 18:07:11 +02:00
|
|
|
'tags',
|
2019-07-01 06:35:36 +02:00
|
|
|
'content',
|
|
|
|
'app',
|
|
|
|
'search',
|
2019-08-02 17:11:31 +02:00
|
|
|
'blocked',
|
2021-03-25 12:24:49 +01:00
|
|
|
'coinSwap',
|
2019-09-17 20:49:03 +02:00
|
|
|
'settings',
|
2019-10-15 06:20:12 +02:00
|
|
|
'subscriptions',
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
'collections',
|
2019-07-01 06:35:36 +02:00
|
|
|
];
|
2019-07-02 23:00:05 +02:00
|
|
|
|
2019-07-23 10:05:51 +02:00
|
|
|
const transforms = [
|
2021-06-25 00:06:08 +02:00
|
|
|
claimsFilter,
|
2019-07-23 10:05:51 +02:00
|
|
|
fileInfoFilter,
|
2019-10-24 20:07:48 +02:00
|
|
|
walletFilter,
|
2019-07-08 22:54:58 +02:00
|
|
|
blockedFilter,
|
2021-04-04 09:10:55 +02:00
|
|
|
coinSwapsFilter,
|
2019-09-26 18:07:11 +02:00
|
|
|
tagsFilter,
|
2019-07-23 10:05:51 +02:00
|
|
|
appFilter,
|
|
|
|
searchFilter,
|
|
|
|
tagsFilter,
|
2019-09-17 20:57:22 +02:00
|
|
|
contentFilter,
|
2019-10-15 06:20:12 +02:00
|
|
|
subscriptionsFilter,
|
2019-11-12 23:03:11 +01:00
|
|
|
settingsFilter,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
collectionsFilter,
|
2019-07-23 10:05:51 +02:00
|
|
|
createCompressor(),
|
|
|
|
];
|
|
|
|
|
2017-06-15 06:27:23 +02:00
|
|
|
const persistOptions = {
|
2019-07-23 10:05:51 +02:00
|
|
|
key: 'v0',
|
|
|
|
storage: localForage,
|
|
|
|
stateReconciler: autoMergeLevel2,
|
2019-07-01 06:35:36 +02:00
|
|
|
whitelist: whiteListedReducers,
|
2017-06-15 06:27:23 +02:00
|
|
|
// Order is important. Needs to be compressed last or other transforms can't
|
|
|
|
// read the data
|
2019-07-23 10:05:51 +02:00
|
|
|
transforms,
|
2017-06-15 06:27:23 +02:00
|
|
|
};
|
2017-04-07 07:15:22 +02:00
|
|
|
|
2019-07-23 10:05:51 +02:00
|
|
|
let history;
|
|
|
|
// @if TARGET='app'
|
2020-02-07 05:49:28 +01:00
|
|
|
history = createMemoryHistory({
|
2020-02-12 05:59:30 +01:00
|
|
|
initialEntries: [generateInitialUrl(window.location.hash)],
|
2020-02-07 05:49:28 +01:00
|
|
|
initialIndex: 0,
|
|
|
|
});
|
2019-07-23 10:05:51 +02:00
|
|
|
// @endif
|
|
|
|
// @if TARGET='web'
|
|
|
|
history = createBrowserHistory();
|
|
|
|
// @endif
|
|
|
|
|
2019-10-15 17:47:43 +02:00
|
|
|
const triggerSharedStateActions = [
|
2019-10-15 06:20:12 +02:00
|
|
|
ACTIONS.CHANNEL_SUBSCRIBE,
|
|
|
|
ACTIONS.CHANNEL_UNSUBSCRIBE,
|
2020-07-15 15:50:08 +02:00
|
|
|
ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
2021-04-04 09:10:55 +02:00
|
|
|
ACTIONS.ADD_COIN_SWAP,
|
|
|
|
ACTIONS.REMOVE_COIN_SWAP,
|
2020-10-05 20:31:51 +02:00
|
|
|
ACTIONS.TOGGLE_TAG_FOLLOW,
|
2019-10-15 17:47:43 +02:00
|
|
|
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
|
2020-07-10 23:04:36 +02:00
|
|
|
ACTIONS.SYNC_CLIENT_SETTINGS,
|
2020-02-25 17:55:22 +01:00
|
|
|
// Disabled until we can overwrite preferences
|
2020-07-10 23:04:36 +02:00
|
|
|
LBRY_REDUX_ACTIONS.SHARED_PREFERENCE_SET,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
LBRY_REDUX_ACTIONS.COLLECTION_EDIT,
|
|
|
|
LBRY_REDUX_ACTIONS.COLLECTION_DELETE,
|
|
|
|
LBRY_REDUX_ACTIONS.COLLECTION_NEW,
|
|
|
|
LBRY_REDUX_ACTIONS.COLLECTION_PENDING,
|
|
|
|
// MAYBE COLLECTOIN SAVE
|
2020-02-25 17:55:22 +01:00
|
|
|
// ACTIONS.SET_WELCOME_VERSION,
|
|
|
|
// ACTIONS.SET_ALLOW_ANALYTICS,
|
2019-10-15 06:20:12 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* source: the reducer name
|
|
|
|
* property: the property in the reducer-specific state
|
|
|
|
* transform: optional method to modify the value to be stored
|
2019-10-15 18:09:33 +02:00
|
|
|
*
|
|
|
|
* See https://github.com/lbryio/lbry-redux/blob/master/src/redux/middleware/shared-state.js for the source
|
|
|
|
* This is based off v0.1
|
|
|
|
* If lbry-redux changes to another version, this code will need to be changed when upgrading
|
2019-10-15 06:20:12 +02:00
|
|
|
*/
|
|
|
|
const sharedStateFilters = {
|
|
|
|
tags: { source: 'tags', property: 'followedTags' },
|
|
|
|
subscriptions: {
|
|
|
|
source: 'subscriptions',
|
|
|
|
property: 'subscriptions',
|
2021-03-03 19:50:16 +01:00
|
|
|
transform: (value) => {
|
2019-10-15 06:20:12 +02:00
|
|
|
return value.map(({ uri }) => uri);
|
|
|
|
},
|
|
|
|
},
|
2020-11-02 17:51:08 +01:00
|
|
|
following: {
|
|
|
|
source: 'subscriptions',
|
|
|
|
property: 'following',
|
|
|
|
},
|
2019-10-15 06:20:12 +02:00
|
|
|
blocked: { source: 'blocked', property: 'blockedChannels' },
|
2021-04-08 11:02:37 +02:00
|
|
|
coin_swap_codes: {
|
|
|
|
source: 'coinSwap',
|
|
|
|
property: 'coinSwaps',
|
|
|
|
transform: (coinSwaps) => {
|
|
|
|
return coinSwaps.map((coinSwapInfo) => coinSwapInfo.chargeCode);
|
|
|
|
},
|
|
|
|
},
|
2019-12-13 20:47:50 +01:00
|
|
|
settings: { source: 'settings', property: 'sharedPreferences' },
|
2020-02-19 07:31:40 +01:00
|
|
|
app_welcome_version: { source: 'app', property: 'welcomeVersion' },
|
|
|
|
sharing_3P: { source: 'app', property: 'allowAnalytics' },
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
builtinCollections: { source: 'collections', property: 'builtin' },
|
2021-08-01 23:01:07 +02:00
|
|
|
editedCollections: { source: 'collections', property: 'edited' },
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
// savedCollections: { source: 'collections', property: 'saved' },
|
|
|
|
unpublishedCollections: { source: 'collections', property: 'unpublished' },
|
2019-10-15 06:20:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const sharedStateCb = ({ dispatch, getState }) => {
|
2021-01-21 20:50:51 +01:00
|
|
|
dispatch(doSyncLoop());
|
2019-10-15 06:20:12 +02:00
|
|
|
};
|
|
|
|
|
2020-06-08 19:27:08 +02:00
|
|
|
const populateAuthTokenHeader = () => {
|
2021-03-03 19:50:16 +01:00
|
|
|
return (next) => (action) => {
|
2020-06-09 19:03:47 +02:00
|
|
|
if (
|
2020-06-15 22:33:03 +02:00
|
|
|
(action.type === ACTIONS.USER_FETCH_SUCCESS || action.type === ACTIONS.AUTHENTICATION_SUCCESS) &&
|
2020-06-09 19:03:47 +02:00
|
|
|
action.data.user.has_verified_email === true
|
|
|
|
) {
|
2020-06-08 19:27:08 +02:00
|
|
|
const authToken = getAuthToken();
|
|
|
|
Lbry.setApiHeader(X_LBRY_AUTH_TOKEN, authToken);
|
|
|
|
}
|
|
|
|
|
2020-06-08 20:22:03 +02:00
|
|
|
return next(action);
|
2020-06-08 19:27:08 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-10-15 17:47:43 +02:00
|
|
|
const sharedStateMiddleware = buildSharedStateMiddleware(triggerSharedStateActions, sharedStateFilters, sharedStateCb);
|
2019-07-23 10:05:51 +02:00
|
|
|
const rootReducer = createRootReducer(history);
|
|
|
|
const persistedReducer = persistReducer(persistOptions, rootReducer);
|
|
|
|
const bulkThunk = createBulkThunkMiddleware();
|
2020-06-08 19:27:08 +02:00
|
|
|
const middleware = [
|
|
|
|
sharedStateMiddleware,
|
|
|
|
// @if TARGET='web'
|
|
|
|
populateAuthTokenHeader,
|
|
|
|
// @endif
|
|
|
|
routerMiddleware(history),
|
|
|
|
thunk,
|
|
|
|
bulkThunk,
|
|
|
|
];
|
2019-07-23 10:05:51 +02:00
|
|
|
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
|
|
|
const store = createStore(
|
|
|
|
enableBatching(persistedReducer),
|
|
|
|
{}, // initial state
|
|
|
|
composeEnhancers(applyMiddleware(...middleware))
|
|
|
|
);
|
|
|
|
|
|
|
|
const persistor = persistStore(store);
|
|
|
|
window.persistor = persistor;
|
2017-12-08 21:14:35 +01:00
|
|
|
|
2019-07-23 10:05:51 +02:00
|
|
|
export { store, persistor, history, whiteListedReducers };
|