better user errors
This commit is contained in:
parent
6f27525ec2
commit
b5383a312e
2 changed files with 18 additions and 17 deletions
|
@ -359,10 +359,7 @@ export function doLbryReady() {
|
|||
|
||||
// TODO: call doFetchDaemonSettings, then get usage data, and call doAuthenticate once they are loaded into the store
|
||||
const shareUsageData = IS_WEB || window.localStorage.getItem(SHARE_INTERNAL) === 'true';
|
||||
/**
|
||||
* doAuthenticate -> Lbryio.authenticate, then update redux with auth token.
|
||||
* authenticate: Use auth token to get or create user.getCurrentUser. return user
|
||||
*/
|
||||
|
||||
dispatch(
|
||||
doAuthenticate(
|
||||
appVersion,
|
||||
|
|
|
@ -131,20 +131,24 @@ export function doAuthenticate(
|
|||
const user = await Lbryio.fetchUser(DOMAIN, getDefaultLanguage());
|
||||
console.log('USER', user);
|
||||
if (sessionStorageAvailable) window.sessionStorage.removeItem(AUTH_IN_PROGRESS);
|
||||
// put this back , accessToken: tokens.access_token
|
||||
Lbryio.getTokens().then((tokens) => {
|
||||
dispatch({
|
||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||
data: { user, accessToken: tokens.auth_token }, // rename 'accessToken' = auth_token
|
||||
});
|
||||
if (shareUsageData) {
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus(false));
|
||||
if (callInstall) {
|
||||
doInstallNew(appVersion, callbackForUsersWhoAreSharingData, DOMAIN);
|
||||
// put this back: accessToken: tokens.access_token
|
||||
if (user.error) {
|
||||
throw new Error(user.error.message);
|
||||
} else {
|
||||
Lbryio.getTokens().then((tokens) => {
|
||||
dispatch({
|
||||
type: ACTIONS.AUTHENTICATION_SUCCESS,
|
||||
data: { user, accessToken: tokens.auth_token }, // rename 'accessToken' = authToken
|
||||
});
|
||||
if (shareUsageData) {
|
||||
dispatch(doRewardList());
|
||||
dispatch(doFetchInviteStatus(false));
|
||||
if (callInstall) {
|
||||
doInstallNew(appVersion, callbackForUsersWhoAreSharingData, DOMAIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (sessionStorageAvailable) window.sessionStorage.removeItem(AUTH_IN_PROGRESS);
|
||||
|
||||
|
|
Loading…
Reference in a new issue