lbry-desktop/ui/js/actions/file_info.js
2017-05-02 19:30:28 -04:00

34 lines
758 B
JavaScript

import * as types from 'constants/action_types'
import lbry from 'lbry'
import {
selectCurrentUri,
} from 'selectors/app'
import {
selectCurrentUriClaimOutpoint,
} from 'selectors/claims'
export function doFetchCurrentUriFileInfo() {
return function(dispatch, getState) {
const state = getState()
const uri = selectCurrentUri(state)
const outpoint = selectCurrentUriClaimOutpoint(state)
dispatch({
type: types.FETCH_FILE_INFO_STARTED,
data: {
uri,
outpoint,
}
})
lbry.file_list({ outpoint: outpoint, full_status: true }).then(([fileInfo]) => {
dispatch({
type: types.FETCH_FILE_INFO_COMPLETED,
data: {
uri,
fileInfo,
}
})
})
}
}