Skip to content

Commit

Permalink
Remove store.js configuration file (#1666)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbodnar committed Jun 3, 2021
1 parent bffb63c commit db9d28e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 51 deletions.
44 changes: 39 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,50 @@ import "regenerator-runtime/runtime";
import React from 'react'
import ReactDOM from 'react-dom'

import { createStore } from 'redux'
import storage from 'redux-persist/lib/storage'
import { createBrowserHistory } from 'history'
import { Provider } from 'react-redux'
import { LocalizeProvider } from 'react-localize-redux';

import { persistStore, persistReducer } from 'redux-persist'
import { PersistGate } from 'redux-persist/integration/react'

import createRootReducer from './reducers'
import createMiddleware from './middleware'
import { initSentry } from './utils/sentry'
import Routing from './components/Routing'
import StoreConfiguration from './redux/store'
import { history } from './redux/store'

import { ACCOUNT_ID_SUFFIX } from './utils/wallet'

initSentry();

const persistConfig = {
key: `wallet.near.org:${ACCOUNT_ID_SUFFIX}`,
storage,
blacklist: ['status', 'staking'],
writeFailHandler: (error) => {
if (error.name === 'QuotaExceededError') {
persistor.pause()
}
}
}

export const history = createBrowserHistory()

const persistedReducer = persistReducer(persistConfig, createRootReducer(history))

export const store = createStore(persistedReducer, createMiddleware(history))

let persistor = persistStore(store)

ReactDOM.render(
<StoreConfiguration>
<Routing history={history} />
</StoreConfiguration>,
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<LocalizeProvider store={store}>
<Routing history={history} />
</LocalizeProvider>
</PersistGate>
</Provider>,
document.getElementById('root')
)
43 changes: 0 additions & 43 deletions src/redux/store.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/alerts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { store } from '../redux/store'
import { store } from '..'
import { clearGlobalAlert, clearLocalAlert } from '../actions/status'

export const showAlert = ({data, onlyError, onlySuccess, console = true, localAlert, messageCodeHeader, success} = {}) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/utils/twoFactor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as nearApiJs from 'near-api-js'
import { store } from '../redux/store'
import { store } from '..'
import { promptTwoFactor, refreshAccount } from '../actions/account'
import { MULTISIG_MIN_AMOUNT, ACCOUNT_HELPER_URL } from './wallet'
import { utils } from 'near-api-js'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { generateSeedPhrase } from 'near-seed-phrase';
import { WalletError } from './walletError'
import { setAccountConfirmed, getAccountConfirmed } from './localStorage'

import { store } from '../redux/store'
import { store } from '..'
import {
setSignTransactionStatus,
setLedgerTxSigned,
Expand Down

0 comments on commit db9d28e

Please sign in to comment.