catch claim error on referrer set

This commit is contained in:
jessop 2020-10-07 23:20:35 -04:00 committed by Sean Yesmunt
parent 1100a07108
commit 7678eedf4d

View file

@ -647,7 +647,14 @@ export function doUserSetReferrer(referrer, shouldClaim) {
if (!claim) {
try {
const response = await Lbry.resolve({ urls: [uri] });
claim = response && response[uri];
if (response && response[uri] && !response[uri].error) claim = response && response[uri];
if (claim) {
if (claim.signing_channel) {
referrerCode = claim.signing_channel.permanent_url.replace('lbry://', '');
} else {
referrerCode = claim.permanent_url.replace('lbry://', '');
}
}
} catch (error) {
dispatch({
type: ACTIONS.USER_SET_REFERRER_FAILURE,
@ -655,13 +662,6 @@ export function doUserSetReferrer(referrer, shouldClaim) {
});
}
}
if (claim) {
if (claim.signing_channel) {
referrerCode = claim.signing_channel.permanent_url.replace('lbry://', '');
} else {
referrerCode = claim.permanent_url.replace('lbry://', '');
}
}
}
if (!referrerCode) {