mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Improve local storage
This commit is contained in:
@@ -8,6 +8,7 @@ import { HttpService } from './http.service';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { AuthConnstants } from '../config/auth-constants';
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { LocalstoreService } from '../store/localstore.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -26,15 +27,15 @@ export class AuthService {
|
||||
private storageService:StorageService,
|
||||
private router:Router,
|
||||
public alertController: AlertController,
|
||||
private localstoreService: LocalstoreService
|
||||
) {
|
||||
|
||||
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
|
||||
if (localStorage.getItem("user") != null) {
|
||||
this.ValidatedUser = JSON.parse(localStorage.getItem('user'));
|
||||
if (localstoreService.get('user', null) != null) {
|
||||
this.ValidatedUser = localstoreService.get('user',{});
|
||||
}
|
||||
|
||||
if (localStorage.getItem("userChat") != null) {
|
||||
this.ValidatedUserChat = JSON.parse(localStorage.getItem('userChat'));
|
||||
}
|
||||
@@ -71,7 +72,7 @@ export class AuthService {
|
||||
response.BasicAuthKey = user.BasicAuthKey
|
||||
this.ValidatedUser = response;
|
||||
|
||||
localStorage.setItem('user', JSON.stringify(response));
|
||||
this.localstoreService.set('user',response)
|
||||
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user