Merge pull request #80 from lbryio/user-fix
add back user to state when calling doAuthenticate
This commit is contained in:
commit
866a80a552
5 changed files with 40 additions and 30 deletions
25
dist/bundle.es.js
vendored
25
dist/bundle.es.js
vendored
|
@ -1299,17 +1299,19 @@ function doAuthenticate(appVersion, os = null, firebaseToken = null) {
|
|||
dispatch({
|
||||
type: AUTHENTICATION_STARTED
|
||||
});
|
||||
Lbryio.authenticate().then(accessToken => {
|
||||
// analytics.setUser(user);
|
||||
dispatch({
|
||||
type: AUTHENTICATION_SUCCESS,
|
||||
data: {
|
||||
accessToken
|
||||
}
|
||||
Lbryio.authenticate().then(user => {
|
||||
Lbryio.getAuthToken().then(token => {
|
||||
dispatch({
|
||||
type: AUTHENTICATION_SUCCESS,
|
||||
data: {
|
||||
user,
|
||||
accessToken: token
|
||||
}
|
||||
});
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
});
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
}).catch(error => {
|
||||
dispatch({
|
||||
type: AUTHENTICATION_FAILURE,
|
||||
|
@ -2978,7 +2980,8 @@ reducers$2[AUTHENTICATION_STARTED] = state => Object.assign({}, state, {
|
|||
reducers$2[AUTHENTICATION_SUCCESS] = (state, action) => Object.assign({}, state, {
|
||||
authenticationIsPending: false,
|
||||
userIsPending: false,
|
||||
accessToken: action.data.accessToken
|
||||
accessToken: action.data.accessToken,
|
||||
user: action.data.user
|
||||
});
|
||||
|
||||
reducers$2[AUTHENTICATION_FAILURE] = state => Object.assign({}, state, {
|
||||
|
|
25
dist/bundle.js
vendored
25
dist/bundle.js
vendored
|
@ -4926,17 +4926,19 @@ function doAuthenticate(appVersion) {
|
|||
dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
||||
});
|
||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (accessToken) {
|
||||
// analytics.setUser(user);
|
||||
dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
||||
data: {
|
||||
accessToken: accessToken
|
||||
}
|
||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (user) {
|
||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].getAuthToken().then(function (token) {
|
||||
dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
||||
data: {
|
||||
user: user,
|
||||
accessToken: token
|
||||
}
|
||||
});
|
||||
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
});
|
||||
dispatch(Object(redux_actions_rewards__WEBPACK_IMPORTED_MODULE_2__["doRewardList"])());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
})["catch"](function (error) {
|
||||
dispatch({
|
||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_FAILURE"],
|
||||
|
@ -6807,7 +6809,8 @@ reducers[constants_action_types__WEBPACK_IMPORTED_MODULE_0__["AUTHENTICATION_SUC
|
|||
return Object.assign({}, state, {
|
||||
authenticationIsPending: false,
|
||||
userIsPending: false,
|
||||
accessToken: action.data.accessToken
|
||||
accessToken: action.data.accessToken,
|
||||
user: action.data.user
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -175,6 +175,7 @@ Lbryio.authenticate = () => {
|
|||
if (!user) {
|
||||
return Lbryio.getCurrentUser();
|
||||
}
|
||||
|
||||
return user;
|
||||
})
|
||||
.then(resolve, reject);
|
||||
|
|
|
@ -71,15 +71,17 @@ export function doAuthenticate(appVersion, os = null, firebaseToken = null) {
|
|||
});
|
||||
|
||||
Lbryio.authenticate()
|
||||
.then(accessToken => {
|
||||
// analytics.setUser(user);
|
||||
dispatch({
|
||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||
data: { accessToken },
|
||||
.then(user => {
|
||||
Lbryio.getAuthToken().then(token => {
|
||||
dispatch({
|
||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||
data: { user, accessToken: token },
|
||||
});
|
||||
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
});
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus());
|
||||
doInstallNew(appVersion, os, firebaseToken);
|
||||
})
|
||||
.catch(error => {
|
||||
dispatch({
|
||||
|
|
|
@ -37,6 +37,7 @@ reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) =>
|
|||
authenticationIsPending: false,
|
||||
userIsPending: false,
|
||||
accessToken: action.data.accessToken,
|
||||
user: action.data.user,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
|
||||
|
|
Loading…
Reference in a new issue