lbry-desktop/ui/js/actions/user.js

21 lines
484 B
JavaScript
Raw Normal View History

2017-06-01 18:20:12 +02:00
import * as types from 'constants/action_types'
import lbryio from 'lbryio'
export function doAuthenticate() {
return function(dispatch, getState) {
dispatch({
type: types.AUTHENTICATION_STARTED,
})
lbryio.authenticate().then((user) => {
dispatch({
type: types.AUTHENTICATION_SUCCESS,
data: { user }
})
}).catch((error) => {
dispatch({
type: types.AUTHENTICATION_FAILURE,
data: { error }
})
})
}
}