Remove makeQueryExecuter middleware
LOAD_TIME_SERIES action is not listened to be any reducer in the app.pull/1232/head
parent
4e3558a437
commit
573716d8a0
|
@ -1,32 +0,0 @@
|
|||
import AJAX from 'utils/ajax'
|
||||
|
||||
// makeQueryExecuter responds to actions that need to make a query to InfluxDB
|
||||
export default function makeQueryExecuter() {
|
||||
return _ => next => action => { // eslint-disable-line arrow-parens
|
||||
if (action.meta && action.meta.query) {
|
||||
const {host, query} = action.payload
|
||||
|
||||
_fetchTimeSeries(host, query)
|
||||
.then((timeSeries) => {
|
||||
next({
|
||||
type: 'LOAD_TIME_SERIES',
|
||||
payload: {timeSeries, host, query},
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Error occured while fetching time series: ', err.toString()) // eslint-disable-line no-console
|
||||
})
|
||||
}
|
||||
|
||||
next(action)
|
||||
}
|
||||
}
|
||||
|
||||
function _fetchTimeSeries(host, query) {
|
||||
const db = '_internal'
|
||||
const url = encodeURIComponent(`http://${host}/query?db=${db}&epoch=ms&q=${query}`)
|
||||
|
||||
return AJAX({
|
||||
url: `/proxy?proxy_url=${url}`,
|
||||
})
|
||||
}
|
|
@ -7,4 +7,4 @@ export default function resizeLayout() {
|
|||
window.dispatchEvent(new Event('resize'))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import {createStore, applyMiddleware, compose} from 'redux'
|
||||
import {combineReducers} from 'redux'
|
||||
import thunkMiddleware from 'redux-thunk'
|
||||
import makeQueryExecuter from 'src/shared/middleware/queryExecuter'
|
||||
import resizeLayout from 'src/shared/middleware/resizeLayout'
|
||||
import adminReducer from 'src/admin/reducers/admin'
|
||||
import sharedReducers from 'src/shared/reducers'
|
||||
|
@ -23,7 +22,7 @@ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
|
|||
export default function configureStore(initialState) {
|
||||
const createPersistentStore = composeEnhancers(
|
||||
persistStateEnhancer(),
|
||||
applyMiddleware(thunkMiddleware, makeQueryExecuter(), resizeLayout),
|
||||
applyMiddleware(thunkMiddleware, resizeLayout),
|
||||
)(createStore)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue