fix headers, debug
This commit is contained in:
parent
97fc74315c
commit
f133a7ed62
3 changed files with 28 additions and 18 deletions
7
dist/bundle.es.js
vendored
7
dist/bundle.es.js
vendored
|
@ -269,7 +269,8 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||||
};
|
};
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}; // TODO refactor this
|
};
|
||||||
|
console.log('USER ME TOKENS', tokens); // TODO refactor this
|
||||||
// Send both tokens to userMe
|
// Send both tokens to userMe
|
||||||
// delete auth token after success
|
// delete auth token after success
|
||||||
|
|
||||||
|
@ -298,7 +299,8 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||||
const qs = querystring.stringify(fullParams);
|
const qs = querystring.stringify(fullParams);
|
||||||
let url = `${Lbryio.CONNECTION_STRING}${resource}/${action}?${qs}`;
|
let url = `${Lbryio.CONNECTION_STRING}${resource}/${action}?${qs}`;
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET'
|
method: 'GET',
|
||||||
|
headers
|
||||||
};
|
};
|
||||||
|
|
||||||
if (method === 'post') {
|
if (method === 'post') {
|
||||||
|
@ -345,6 +347,7 @@ Lbryio.fetchUser = async (domain, language) => {
|
||||||
let user;
|
let user;
|
||||||
Lbryio.fetchingUser = true;
|
Lbryio.fetchingUser = true;
|
||||||
const tokens = await Lbryio.getTokens(domain, language);
|
const tokens = await Lbryio.getTokens(domain, language);
|
||||||
|
console.log('tokens', tokens);
|
||||||
|
|
||||||
if (!tokens.auth_token && !tokens.access_token) {
|
if (!tokens.auth_token && !tokens.access_token) {
|
||||||
user = await Lbryio.fetchNewUser();
|
user = await Lbryio.fetchNewUser();
|
||||||
|
|
35
dist/bundle.js
vendored
35
dist/bundle.js
vendored
|
@ -576,7 +576,8 @@ Lbryio.call = function (resource, action) {
|
||||||
|
|
||||||
var headers = {
|
var headers = {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}; // TODO refactor this
|
};
|
||||||
|
console.log('USER ME TOKENS', tokens); // TODO refactor this
|
||||||
// Send both tokens to userMe
|
// Send both tokens to userMe
|
||||||
// delete auth token after success
|
// delete auth token after success
|
||||||
|
|
||||||
|
@ -605,7 +606,8 @@ Lbryio.call = function (resource, action) {
|
||||||
var qs = querystring__WEBPACK_IMPORTED_MODULE_1___default.a.stringify(fullParams);
|
var qs = querystring__WEBPACK_IMPORTED_MODULE_1___default.a.stringify(fullParams);
|
||||||
var url = "".concat(Lbryio.CONNECTION_STRING).concat(resource, "/").concat(action, "?").concat(qs);
|
var url = "".concat(Lbryio.CONNECTION_STRING).concat(resource, "/").concat(action, "?").concat(qs);
|
||||||
var options = {
|
var options = {
|
||||||
method: 'GET'
|
method: 'GET',
|
||||||
|
headers: headers
|
||||||
};
|
};
|
||||||
|
|
||||||
if (method === 'post') {
|
if (method === 'post') {
|
||||||
|
@ -671,7 +673,7 @@ function () {
|
||||||
switch (_context.prev = _context.next) {
|
switch (_context.prev = _context.next) {
|
||||||
case 0:
|
case 0:
|
||||||
if (Lbryio.fetchingUser) {
|
if (Lbryio.fetchingUser) {
|
||||||
_context.next = 19;
|
_context.next = 20;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,45 +683,46 @@ function () {
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
tokens = _context.sent;
|
tokens = _context.sent;
|
||||||
|
console.log('tokens', tokens);
|
||||||
|
|
||||||
if (!(!tokens.auth_token && !tokens.access_token)) {
|
if (!(!tokens.auth_token && !tokens.access_token)) {
|
||||||
_context.next = 11;
|
_context.next = 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.next = 8;
|
_context.next = 9;
|
||||||
return Lbryio.fetchNewUser();
|
return Lbryio.fetchNewUser();
|
||||||
|
|
||||||
case 8:
|
case 9:
|
||||||
user = _context.sent;
|
user = _context.sent;
|
||||||
_context.next = 14;
|
_context.next = 15;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 12:
|
||||||
_context.next = 13;
|
_context.next = 14;
|
||||||
return Lbryio.fetchCurrentUser();
|
return Lbryio.fetchCurrentUser();
|
||||||
|
|
||||||
case 13:
|
case 14:
|
||||||
user = _context.sent;
|
user = _context.sent;
|
||||||
|
|
||||||
case 14:
|
case 15:
|
||||||
if (!tokens.access_token) {
|
if (!tokens.access_token) {
|
||||||
_context.next = 18;
|
_context.next = 19;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tokens.auth_token) {
|
if (!tokens.auth_token) {
|
||||||
_context.next = 18;
|
_context.next = 19;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.next = 18;
|
_context.next = 19;
|
||||||
return Lbryio.deleteAuthToken();
|
return Lbryio.deleteAuthToken();
|
||||||
|
|
||||||
case 18:
|
case 19:
|
||||||
return _context.abrupt("return", user);
|
return _context.abrupt("return", user);
|
||||||
|
|
||||||
case 19:
|
case 20:
|
||||||
case "end":
|
case "end":
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('USER ME TOKENS', tokens);
|
||||||
|
|
||||||
// TODO refactor this
|
// TODO refactor this
|
||||||
// Send both tokens to userMe
|
// Send both tokens to userMe
|
||||||
// delete auth token after success
|
// delete auth token after success
|
||||||
|
@ -89,6 +91,7 @@ Lbryio.call = (resource, action, params = {}, method = 'get') => {
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
headers,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (method === 'post') {
|
if (method === 'post') {
|
||||||
|
@ -135,6 +138,7 @@ Lbryio.fetchUser = async (domain, language) => {
|
||||||
let user;
|
let user;
|
||||||
Lbryio.fetchingUser = true;
|
Lbryio.fetchingUser = true;
|
||||||
const tokens = await Lbryio.getTokens(domain, language);
|
const tokens = await Lbryio.getTokens(domain, language);
|
||||||
|
console.log('tokens', tokens);
|
||||||
if (!tokens.auth_token && !tokens.access_token) {
|
if (!tokens.auth_token && !tokens.access_token) {
|
||||||
user = await Lbryio.fetchNewUser();
|
user = await Lbryio.fetchNewUser();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue