lbry-desktop/ui/js/actions/user.js
2017-06-07 11:56:01 -04:00

21 lines
No EOL
484 B
JavaScript

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 }
})
})
}
}