Refactor auth #112
3 changed files with 25 additions and 6 deletions
12
dist/bundle.es.js
vendored
12
dist/bundle.es.js
vendored
|
@ -333,7 +333,11 @@ Lbryio.deleteAuthToken = () => new Promise(resolve => {
|
|||
});
|
||||
});
|
||||
|
||||
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me');
|
||||
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me').catch(e => ({
|
||||
error: {
|
||||
message: e.message
|
||||
}
|
||||
}));
|
||||
|
||||
Lbryio.fetchUser = async (domain, language) => {
|
||||
if (!Lbryio.fetchingUser) {
|
||||
|
@ -376,7 +380,11 @@ Lbryio.fetchNewUser = async (domain, language) => {
|
|||
return userResponse;
|
||||
} catch (e) {
|
||||
console.log('error', e.message);
|
||||
return false;
|
||||
return {
|
||||
error: {
|
||||
message: e.message
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
14
dist/bundle.js
vendored
14
dist/bundle.js
vendored
|
@ -649,7 +649,13 @@ Lbryio.deleteAuthToken = function () {
|
|||
};
|
||||
|
||||
Lbryio.fetchCurrentUser = function () {
|
||||
return Lbryio.call('user', 'me');
|
||||
return Lbryio.call('user', 'me')["catch"](function (e) {
|
||||
return {
|
||||
error: {
|
||||
message: e.message
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Lbryio.fetchUser =
|
||||
|
@ -771,7 +777,11 @@ function () {
|
|||
_context2.prev = 17;
|
||||
_context2.t0 = _context2["catch"](0);
|
||||
console.log('error', _context2.t0.message);
|
||||
return _context2.abrupt("return", false);
|
||||
return _context2.abrupt("return", {
|
||||
error: {
|
||||
message: _context2.t0.message
|
||||
}
|
||||
});
|
||||
|
||||
case 21:
|
||||
case "end":
|
||||
|
|
|
@ -127,7 +127,8 @@ Lbryio.deleteAuthToken = () =>
|
|||
});
|
||||
});
|
||||
|
||||
Lbryio.fetchCurrentUser = () => Lbryio.call('user', 'me');
|
||||
Lbryio.fetchCurrentUser = () =>
|
||||
Lbryio.call('user', 'me').catch(e => ({ error: { message: e.message } }));
|
||||
|
||||
Lbryio.fetchUser = async (domain, language) => {
|
||||
if (!Lbryio.fetchingUser) {
|
||||
|
@ -173,7 +174,7 @@ Lbryio.fetchNewUser = async (domain, language) => {
|
|||
return userResponse;
|
||||
} catch (e) {
|
||||
console.log('error', e.message);
|
||||
return false;
|
||||
return { error: { message: e.message } };
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue