From 655f83af9ba59d6153c9916b9a31bfe12680655e Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Mon, 31 Mar 2025 13:12:42 -0400 Subject: Implemented localStorage cookies to maintain user persistence --- ufund-ui/src/app/app.component.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'ufund-ui/src/app/app.component.ts') diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 8068659..34256f3 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,5 +1,5 @@ -import {Component, OnInit, Inject, ViewChild} from '@angular/core'; -import {BehaviorSubject, Observable} from 'rxjs'; +import {Component, OnInit, Inject} from '@angular/core'; +import {BehaviorSubject} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; import {ToastType} from './services/toasts.service'; @@ -34,7 +34,17 @@ export class AppComponent implements OnInit { } ngOnInit() { + console.log("AAAAAAAAAAAAAAAA") this.currentUser = this.authService.getCurrentUserSubject() + let data = localStorage.getItem("credential"); + if (data) { + let dataParsed = JSON.parse(data) + this.authService.restoreLogin(dataParsed.username, dataParsed.key) + console.log("Key found", dataParsed.key) + } else { + console.log("key missing") + console.log(data) + } } login() { -- cgit v1.2.3