Merge pull request #20 from lbryio/email-verification
Add `fetchSilently` param for `doUserFetch`
This commit is contained in:
commit
cee70d482c
2 changed files with 35 additions and 16 deletions
11
dist/bundle.js
vendored
11
dist/bundle.js
vendored
|
@ -8680,8 +8680,17 @@ function doAuthenticate(appVersion) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function doUserFetch() {
|
function doUserFetch(fetchSilently) {
|
||||||
return function (dispatch) {
|
return function (dispatch) {
|
||||||
|
// If we are doing this in the background, do not set loading = true
|
||||||
|
if (fetchSilently) {
|
||||||
|
return _lbryio2.default.getCurrentUser().then(function (user) {
|
||||||
|
dispatch({
|
||||||
|
type: _lbryRedux.ACTIONS.USER_FETCH_SUCCESS,
|
||||||
|
data: { user: user }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
dispatch({
|
dispatch({
|
||||||
type: _lbryRedux.ACTIONS.USER_FETCH_STARTED
|
type: _lbryRedux.ACTIONS.USER_FETCH_STARTED
|
||||||
});
|
});
|
||||||
|
|
|
@ -74,27 +74,37 @@ export function doAuthenticate(appVersion, os = null) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function doUserFetch() {
|
export function doUserFetch(fetchSilently) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
// If we are doing this in the background, do not set loading = true
|
||||||
type: ACTIONS.USER_FETCH_STARTED,
|
if (fetchSilently) {
|
||||||
});
|
Lbryio.getCurrentUser().then(user => {
|
||||||
Lbryio.getCurrentUser()
|
|
||||||
.then(user => {
|
|
||||||
// analytics.setUser(user);
|
|
||||||
dispatch(doRewardList());
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.USER_FETCH_SUCCESS,
|
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||||
data: { user },
|
data: { user },
|
||||||
});
|
});
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
dispatch({
|
|
||||||
type: ACTIONS.USER_FETCH_FAILURE,
|
|
||||||
data: { error },
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_FETCH_STARTED,
|
||||||
|
});
|
||||||
|
Lbryio.getCurrentUser()
|
||||||
|
.then(user => {
|
||||||
|
// analytics.setUser(user);
|
||||||
|
dispatch(doRewardList());
|
||||||
|
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_FETCH_SUCCESS,
|
||||||
|
data: { user },
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
dispatch({
|
||||||
|
type: ACTIONS.USER_FETCH_FAILURE,
|
||||||
|
data: { error },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue