New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rr-apilib

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rr-apilib - npm Package Compare versions

Comparing version

to
0.2.6-alpha

44

lib/client/Auth.js

@@ -10,3 +10,3 @@ import { __awaiter, __generator } from "tslib";

this.client = client;
this.me = this.getCurrentUser();
this.me = null;
this.token = null;

@@ -16,9 +16,13 @@ this.refresh_token = null;

Auth.prototype.getCurrentUser = function () {
var _this = this;
this.checkAuth();
this.client.rest.getRequest("/users/me")
.then(function (data) {
return new User(_this.client, data);
return __awaiter(this, void 0, void 0, function () {
var data;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.client.rest.getRequest("/users/me", true)];
case 1:
data = _a.sent();
return [2 /*return*/, new User(this.client, data)];
}
});
});
return null;
};

@@ -34,8 +38,8 @@ /** Throw error if user is not connected (for protected routes) */

return __awaiter(this, void 0, void 0, function () {
var data, token, refresh_token;
return __generator(this, function (_a) {
switch (_a.label) {
var data, token, refresh_token, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.client.rest.postRequest("/login_check", { username: username, password: password }, false, 200)];
case 1:
data = _a.sent();
data = _b.sent();
token = data.token, refresh_token = data.refresh_token;

@@ -45,3 +49,6 @@ this.token = token;

this.client.rest.setToken(this.token);
this.me = this.getCurrentUser();
_a = this;
return [4 /*yield*/, this.getCurrentUser()];
case 2:
_a.me = _b.sent();
this.client.refresh();

@@ -59,5 +66,5 @@ return [2 /*return*/, data];

return __awaiter(this, void 0, void 0, function () {
var data, token, refresh_token;
return __generator(this, function (_a) {
switch (_a.label) {
var data, token, refresh_token, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -67,3 +74,3 @@ this.checkAuth();

case 1:
data = _a.sent();
data = _b.sent();
token = data.token, refresh_token = data.refresh_token;

@@ -73,3 +80,6 @@ this.token = token;

this.client.rest.setToken(this.token);
this.me = this.getCurrentUser();
_a = this;
return [4 /*yield*/, this.getCurrentUser()];
case 2:
_a.me = _b.sent();
this.client.refresh();

@@ -76,0 +86,0 @@ return [2 /*return*/, data];

{
"name": "rr-apilib",
"version": "0.2.5-alpha",
"version": "0.2.6-alpha",
"description": "Library for interact with RR-API",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet