From 500414c849c0d085d431ebbaad6cbc1f9ff29c65 Mon Sep 17 00:00:00 2001 From: Rania Chowdhury Date: Wed, 3 Apr 2019 15:55:22 -0400 Subject: [PATCH] issue with pressing back instead of links for local storage --- package-lock.json | 8 ++++++-- src/app/authentication/authentication.component.ts | 8 +++++++- src/app/generator-search/generator-search.component.ts | 5 +++++ src/app/statistics/statistics.component.ts | 4 +++- src/app/visualize-all/visualize-all.component.ts | 5 +++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 513eb32..540209a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3933,12 +3933,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3958,7 +3960,8 @@ "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", @@ -4106,6 +4109,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } diff --git a/src/app/authentication/authentication.component.ts b/src/app/authentication/authentication.component.ts index 741d0d6..ca2e123 100644 --- a/src/app/authentication/authentication.component.ts +++ b/src/app/authentication/authentication.component.ts @@ -48,6 +48,12 @@ export class AuthenticationComponent implements OnInit { } - ngOnInit() { } + ngOnInit() { + localStorage.removeItem('gen_id'); + localStorage.removeItem('org_id'); + localStorage.removeItem('gen_name'); + localStorage.removeItem('data_type'); + localStorage.removeItem('fault_type'); + } } diff --git a/src/app/generator-search/generator-search.component.ts b/src/app/generator-search/generator-search.component.ts index eeb64aa..c45e194 100644 --- a/src/app/generator-search/generator-search.component.ts +++ b/src/app/generator-search/generator-search.component.ts @@ -24,6 +24,11 @@ export class GeneratorSearchComponent implements OnInit { } ngOnInit() { + localStorage.removeItem('gen_id'); + localStorage.removeItem('org_id'); + localStorage.removeItem('gen_name'); + localStorage.removeItem('data_type'); + localStorage.removeItem('fault_type'); const jsonToken = localStorage.getItem('auth_token'); try { this.data.getGenerators(jsonToken).subscribe((data) => { diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts index 40186f8..0f768c4 100644 --- a/src/app/statistics/statistics.component.ts +++ b/src/app/statistics/statistics.component.ts @@ -10,7 +10,7 @@ import { Router } from '@angular/router'; }) export class StatisticsComponent implements OnInit { - + constructor(public data: MetricsService, private http: HttpClient, private router: Router) { } @@ -159,6 +159,8 @@ export class StatisticsComponent implements OnInit { ngOnInit() { + localStorage.removeItem('data_type'); + localStorage.removeItem('fault_type'); const jsonToken = localStorage.getItem('auth_token'); try { this.data.getDevMetrics(jsonToken).subscribe((data) => { diff --git a/src/app/visualize-all/visualize-all.component.ts b/src/app/visualize-all/visualize-all.component.ts index 5f99604..30c4722 100644 --- a/src/app/visualize-all/visualize-all.component.ts +++ b/src/app/visualize-all/visualize-all.component.ts @@ -183,6 +183,11 @@ export class VisualizeAllComponent implements OnInit { } ngOnInit() { + localStorage.removeItem('gen_id'); + localStorage.removeItem('org_id'); + localStorage.removeItem('gen_name'); + localStorage.removeItem('data_type'); + localStorage.removeItem('fault_type'); this.dataNames$ = this.data.getAllNames('layman'); const jsonToken = localStorage.getItem('auth_token');