Socket
Socket
Sign inDemoInstall

co-auther

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-auther - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "co-auther",
"version": "1.1.0",
"version": "1.1.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/co-auther/co-auther.js",

@@ -0,1 +1,4 @@

// Adaptor for use with Angular 2 to enable dependency injection
// TODO: should probably provide options with provider to make routes etc
// available immediately
"use strict";

@@ -2,0 +5,0 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -0,1 +1,5 @@

// Adaptor for use with Angular 2 to enable dependency injection
// TODO: should probably provide options with provider to make routes etc
// available immediately
import {Injectable} from '@angular/core'

@@ -2,0 +6,0 @@ import {CoAuther} from './co-auther'

@@ -47,19 +47,18 @@ "use strict";

.then(function () {
// flag for initial data
_this.initialDataLoaded = true;
});
};
CoAuther.prototype.activationHelper = function (destinationRequested) {
CoAuther.prototype.activationHelper = function (routeRequest) {
var _this = this;
var destinationResult = null;
var routeResult = null;
var authData = localStorage.getItem(this.authDataKey);
// authData and initialRequest done, suggest LOGGED_IN
if (authData && this.initialDataLoaded) {
destinationResult = this.loggedInRoute;
routeResult = this.loggedInRoute;
}
else if (!authData && !this.initialRequestPending) {
destinationResult = this.authenticateRoute;
routeResult = this.authenticateRoute;
}
else {
destinationResult = this.initialRequestRoute;
routeResult = this.initialRequestRoute;
if (!this.initialRequestPending && !this.initialRequestFailed) {

@@ -71,3 +70,3 @@ this.initialRequestPending = true;

_this.initialRequestPending = false;
destinationResult = _this.loggedInRoute;
routeResult = _this.loggedInRoute;
})

@@ -78,15 +77,15 @@ .catch(function (err) {

_this.initialRequestFailed = true;
destinationResult = _this.authenticateRoute;
routeResult = _this.authenticateRoute;
});
}
else if (this.initialRequestFailed && authData) {
// initial request failed, you need to clear authData
console.error('Initial request promise was rejected. You have manual authData management and need to clear authData from localStorage manually.');
// error state, when initialRequest fails, you need to clear authData
console.error('Initial request promise was rejected. You need to clear authData from localStorage.');
}
}
if (this.debugMode) {
console.log('[co-auther] destinationRequested: ' + destinationRequested);
console.log('[co-auther] destinationResult: ' + destinationResult);
console.log('[co-auther] routeReq: ' + routeRequest);
console.log('[co-auther] routeRes: ' + routeResult);
}
return destinationResult;
return routeResult;
};

@@ -93,0 +92,0 @@ return CoAuther;

@@ -40,3 +40,2 @@ export class CoAuther {

.then(() => {
// flag for initial data
this.initialDataLoaded = true

@@ -46,4 +45,4 @@ })

public activationHelper (destinationRequested) {
let destinationResult = null
public activationHelper (routeRequest) {
let routeResult = null
let authData = localStorage.getItem(this.authDataKey)

@@ -53,11 +52,11 @@

if (authData && this.initialDataLoaded) {
destinationResult = this.loggedInRoute
routeResult = this.loggedInRoute
// no authData and no initialRequest pending, suggest AUTHENTICATE
} else if (!authData && !this.initialRequestPending) {
destinationResult = this.authenticateRoute
routeResult = this.authenticateRoute
// authData is available, suggest INITIAL_REQUEST
} else {
destinationResult = this.initialRequestRoute
routeResult = this.initialRequestRoute
if (!this.initialRequestPending && !this.initialRequestFailed) {

@@ -70,3 +69,3 @@ this.initialRequestPending = true

this.initialRequestPending = false
destinationResult = this.loggedInRoute
routeResult = this.loggedInRoute
})

@@ -78,8 +77,8 @@ .catch((err) => {

this.initialRequestFailed = true
destinationResult = this.authenticateRoute
routeResult = this.authenticateRoute
})
} else if (this.initialRequestFailed && authData) {
// initial request failed, you need to clear authData
console.error('Initial request promise was rejected. You have manual authData management and need to clear authData from localStorage manually.')
// error state, when initialRequest fails, you need to clear authData
console.error('Initial request promise was rejected. You need to clear authData from localStorage.')
}

@@ -89,7 +88,7 @@ }

if (this.debugMode) {
console.log('[co-auther] destinationRequested: ' + destinationRequested)
console.log('[co-auther] destinationResult: ' + destinationResult)
console.log('[co-auther] routeReq: ' + routeRequest)
console.log('[co-auther] routeRes: ' + routeResult)
}
return destinationResult
return routeResult
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc