@stackworx/react
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -14,2 +14,4 @@ "use strict"; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _next(value) { step("next", value); } function _throw(err) { step("throw", err); } _next(); }); }; } | ||
@@ -93,3 +95,4 @@ | ||
// $FlowFixMe | ||
_defineProperty(this, "serverUri", void 0); | ||
this.serverUri = serverUri; | ||
@@ -100,43 +103,23 @@ } | ||
key: "login", | ||
value: function () { | ||
var _login = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee2(username | ||
/*: string*/ | ||
, password | ||
/*: string*/ | ||
) { | ||
var headers, credentials, json; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
headers = new Headers(); | ||
credentials = btoa("".concat(username, ":").concat(password)); | ||
json = { | ||
username: username, | ||
password: password, | ||
grant_type: 'password' | ||
}; | ||
headers.append('Authorization', "Basic ".concat(credentials)); | ||
headers.append('Content-Type', 'application/json'); | ||
return _context2.abrupt("return", request({ | ||
// $FlowFixMe | ||
url: "".concat(this.serverUrl, "/oauth/token"), | ||
headers: headers, | ||
json: json | ||
})); | ||
case 6: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
return function login(_x2, _x3) { | ||
return _login.apply(this, arguments); | ||
value: function login(username | ||
/*: string*/ | ||
, password | ||
/*: string*/ | ||
) { | ||
var headers = new Headers(); | ||
var credentials = btoa("".concat(username, ":").concat(password)); | ||
var json = { | ||
username: username, | ||
password: password, | ||
grant_type: 'password' | ||
}; | ||
}() | ||
headers.append('Authorization', "Basic ".concat(credentials)); | ||
headers.append('Content-Type', 'application/json'); | ||
var url = "".concat(this.serverUri, "/oauth/token"); | ||
return request({ | ||
url: url, | ||
headers: headers, | ||
json: json | ||
}); | ||
} | ||
}]); | ||
@@ -143,0 +126,0 @@ |
{ | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"name": "@stackworx/react", | ||
@@ -7,2 +7,3 @@ "devDependencies": { | ||
"@babel/core": "^7.0.0-beta.49", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.49", | ||
"@babel/plugin-transform-flow-comments": "^7.0.0-beta.49", | ||
@@ -9,0 +10,0 @@ "@babel/preset-env": "^7.0.0-beta.49", |
Sorry, the diff of this file is not supported yet
13270
7
203