lbry-desktop/ui/js/actions/search.js
2017-05-04 11:59:45 -04:00

28 lines
569 B
JavaScript

import * as types from 'constants/action_types'
import lbry from 'lbry'
import lbryio from 'lbryio'
import lighthouse from 'lighthouse'
import {
selectSearchQuery,
} from 'selectors/search'
export function doSearchContent(query) {
return function(dispatch, getState) {
const state = getState()
dispatch({
type: types.SEARCH_STARTED,
data: { query }
})
lighthouse.search(query).then(results => {
dispatch({
type: types.SEARCH_COMPLETED,
data: {
query,
results,
}
})
})
}
}