Commit 88d3010b authored by Simone Vuotto's avatar Simone Vuotto

Update angular-jtw and angular-cli dependencies

parent 2ce374cb
This diff is collapsed.
{
"name": "req-v-webapp",
"version": "0.0.0",
"license": "MIT",
"version": "0.0.1",
"license": "LGPL",
"scripts": {
"ng": "ng",
"start": "ng server --proxy-config proxy.conf.json",
......@@ -21,7 +21,7 @@
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"angular2-jwt": "^0.2.3",
"@auth0/angular-jwt": "^1.1.0",
"bootstrap": "^3.3.7",
"bootswatch": "^4.0.0-beta.2",
"core-js": "^2.4.1",
......@@ -32,7 +32,7 @@
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.6.1",
"@angular/cli": "^1.7.4",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
......
import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders, HttpResponse} from '@angular/common/http';
import 'rxjs/add/operator/map';
import { tokenNotExpired } from 'angular2-jwt';
import { JwtHelperService } from '@auth0/angular-jwt';
import { Observable } from 'rxjs/Observable';
const CURRENT_USER = 'currentUser';
......@@ -9,6 +9,8 @@ const CURRENT_USER = 'currentUser';
@Injectable()
export class AuthenticationService {
jwtHelper = new JwtHelperService();
constructor(private http: HttpClient) { }
login(username: string, password: string) {
......@@ -37,7 +39,7 @@ export class AuthenticationService {
const token = this.getToken();
// return a boolean reflecting
// whether or not the token is expired
return tokenNotExpired(null, token);
return !this.jwtHelper.isTokenExpired(token);
}
logout() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment