<commit_before>import { compose, createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import persistState from 'redux-localstorage';
import reducers from './reducers';
import Debug from 'redux-debug';
import debugFactory from 'debug';

const debug = debugFactory( 'voyageur:store' );

const createStoreWithMiddleware = compose(
  applyMiddleware( thunk ),
  applyMiddleware( Debug( debug ) ),
  persistState( 'auth', { key: 'voyageur' } )
)( createStore );

export default createStoreWithMiddleware( reducers );<commit_msg>Persist miles/km choice in localStorage<commit_after>import { compose, createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import persistState from 'redux-localstorage';
import reducers from './reducers';
import Debug from 'redux-debug';
import debugFactory from 'debug';

const debug = debugFactory( 'voyageur:store' );

function storeSlicer() {
  return state => {
    let { auth, ui } = state;
    return { auth, ui: { useMiles: ui.useMiles } };
  };
}

const createStoreWithMiddleware = compose(
  applyMiddleware( thunk ),
  applyMiddleware( Debug( debug ) ),
  persistState( null, { key: 'voyageur', slicer: storeSlicer } )
)( createStore );

export default createStoreWithMiddleware( reducers );
{'fraction_non_alphanumeric': 0.11912225705329153, 'fraction_numerical': 0.0, 'mean_word_length': 5.5487179487179485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '59803', 'n_tokens_mistral': 386, 'n_tokens_neox': 387, 'n_words': 113}