mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix storage in chat
This commit is contained in:
@@ -62,7 +62,7 @@ export class AuthService {
|
||||
if (result)
|
||||
{
|
||||
this.ValidatedUser = user;
|
||||
//this.storageService.store(AuthConnstants.USER, response);
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -80,9 +80,9 @@ export class AuthService {
|
||||
|
||||
//Get user data from RocketChat | global object
|
||||
getUserData(){
|
||||
/* this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
this.userData$.next(res);
|
||||
}); */
|
||||
});
|
||||
}
|
||||
//Get user Id | global object
|
||||
getUserId(){
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Storage } from '@ionic/storage';
|
||||
/* import { Plugins } from '@capacitor/core';
|
||||
const { Storage } = Plugins; */
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class StorageService {
|
||||
constructor() {}
|
||||
constructor(private storage:Storage,) {}
|
||||
|
||||
/* // Store the value
|
||||
async store(storageKey: string, value: any) {
|
||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||
await Storage.set({
|
||||
key: storageKey,
|
||||
value: encryptedValue
|
||||
});
|
||||
// Store the value
|
||||
async store(key: string, value: any){
|
||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||
await this.storage.set(key, encryptedValue);
|
||||
}
|
||||
|
||||
// Get the value
|
||||
async get(key: string) {
|
||||
const ret = await this.storage.get(key).then((val) => {
|
||||
return val;
|
||||
});
|
||||
return JSON.parse(unescape(atob(ret)));
|
||||
}
|
||||
/*
|
||||
// Get the value
|
||||
async get(storageKey: string) {
|
||||
const ret = await Storage.get({ key: storageKey });
|
||||
|
||||
Reference in New Issue
Block a user