add back user to state when calling doAuthenticate
This commit is contained in:
parent
e3520f5216
commit
1912aa1834
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({
|
dispatch({
|
||||||
type: AUTHENTICATION_STARTED
|
type: AUTHENTICATION_STARTED
|
||||||
});
|
});
|
||||||
Lbryio.authenticate().then(accessToken => {
|
Lbryio.authenticate().then(user => {
|
||||||
// analytics.setUser(user);
|
Lbryio.getAuthToken().then(token => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTHENTICATION_SUCCESS,
|
type: AUTHENTICATION_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
accessToken
|
user,
|
||||||
}
|
accessToken: token
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dispatch(doRewardList());
|
||||||
|
dispatch(doFetchInviteStatus());
|
||||||
|
doInstallNew(appVersion, os, firebaseToken);
|
||||||
});
|
});
|
||||||
dispatch(doRewardList());
|
|
||||||
dispatch(doFetchInviteStatus());
|
|
||||||
doInstallNew(appVersion, os, firebaseToken);
|
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: AUTHENTICATION_FAILURE,
|
type: AUTHENTICATION_FAILURE,
|
||||||
|
@ -2978,7 +2980,8 @@ reducers$2[AUTHENTICATION_STARTED] = state => Object.assign({}, state, {
|
||||||
reducers$2[AUTHENTICATION_SUCCESS] = (state, action) => Object.assign({}, state, {
|
reducers$2[AUTHENTICATION_SUCCESS] = (state, action) => Object.assign({}, state, {
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
accessToken: action.data.accessToken
|
accessToken: action.data.accessToken,
|
||||||
|
user: action.data.user
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[AUTHENTICATION_FAILURE] = state => Object.assign({}, state, {
|
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({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_STARTED"]
|
||||||
});
|
});
|
||||||
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (accessToken) {
|
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].authenticate().then(function (user) {
|
||||||
// analytics.setUser(user);
|
lbryio__WEBPACK_IMPORTED_MODULE_5__["default"].getAuthToken().then(function (token) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_SUCCESS"],
|
||||||
data: {
|
data: {
|
||||||
accessToken: accessToken
|
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) {
|
})["catch"](function (error) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: constants_action_types__WEBPACK_IMPORTED_MODULE_1__["AUTHENTICATION_FAILURE"],
|
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, {
|
return Object.assign({}, state, {
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
accessToken: action.data.accessToken
|
accessToken: action.data.accessToken,
|
||||||
|
user: action.data.user
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ Lbryio.authenticate = () => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
return Lbryio.getCurrentUser();
|
return Lbryio.getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
})
|
})
|
||||||
.then(resolve, reject);
|
.then(resolve, reject);
|
||||||
|
|
|
@ -71,15 +71,17 @@ export function doAuthenticate(appVersion, os = null, firebaseToken = null) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Lbryio.authenticate()
|
Lbryio.authenticate()
|
||||||
.then(accessToken => {
|
.then(user => {
|
||||||
// analytics.setUser(user);
|
Lbryio.getAuthToken().then(token => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||||
data: { accessToken },
|
data: { user, accessToken: token },
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch(doRewardList());
|
||||||
|
dispatch(doFetchInviteStatus());
|
||||||
|
doInstallNew(appVersion, os, firebaseToken);
|
||||||
});
|
});
|
||||||
dispatch(doRewardList());
|
|
||||||
dispatch(doFetchInviteStatus());
|
|
||||||
doInstallNew(appVersion, os, firebaseToken);
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -37,6 +37,7 @@ reducers[ACTIONS.AUTHENTICATION_SUCCESS] = (state, action) =>
|
||||||
authenticationIsPending: false,
|
authenticationIsPending: false,
|
||||||
userIsPending: false,
|
userIsPending: false,
|
||||||
accessToken: action.data.accessToken,
|
accessToken: action.data.accessToken,
|
||||||
|
user: action.data.user,
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
|
reducers[ACTIONS.AUTHENTICATION_FAILURE] = state =>
|
||||||
|
|
Loading…
Add table
Reference in a new issue