Я пытаюсь получить состояние из хранилища для установки токенов по умолчанию, когда я console.log
, а затем я нашел undefined
.
Это мой код axiosConfig.js:
import axios from 'axios'
import _ from 'lodash'
const BASE_URL = '********.com'
import store from '../store'
console.log('store', store)
const instance = axios.create({
baseURL: BASE_URL
})
export { instance }
это мой код store.js:
import { createStore, applyMiddleware } from 'redux'
import 'regenerator-runtime/runtime'
import createSagaMiddleware from 'redux-saga'
import rootSaga from './sagas'
import rootReducer from './reducers/index'
import { routerMiddleware } from 'react-router-redux'
import { createBrowserHistory } from 'history'
import logger from 'redux-logger'
export const history = createBrowserHistory()
export const defaultState = {}
const sagaMiddleware = createSagaMiddleware()
const store = createStore(rootReducer, defaultState, applyMiddleware(sagaMiddleware, routerMiddleware(history)))
sagaMiddleware.run(rootSaga)
export default store
Ошибка:
store undefined