mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Fix
This commit is contained in:
@@ -32,8 +32,8 @@ export class AuthService {
|
|||||||
|
|
||||||
this.headers = new HttpHeaders();
|
this.headers = new HttpHeaders();
|
||||||
|
|
||||||
if (localstoreService.get('user', null) != null) {
|
if (this.localstoreService.get('user', null) != null) {
|
||||||
this.ValidatedUser = localstoreService.get('user',{});
|
this.ValidatedUser = this.localstoreService.get('user',{});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem("userChat") != null) {
|
if (localStorage.getItem("userChat") != null) {
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ export class LocalstoreService {
|
|||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
getKey(keyName) {
|
||||||
|
return this.prefix + keyName
|
||||||
|
}
|
||||||
get( keyName, safe) {
|
get( keyName, safe) {
|
||||||
|
|
||||||
keyName = this.prefix + keyName
|
keyName = this.getKey(keyName)
|
||||||
|
|
||||||
const ciphertext = localStorage.getItem(keyName)
|
const ciphertext = localStorage.getItem(keyName)
|
||||||
|
|
||||||
@@ -21,18 +24,18 @@ export class LocalstoreService {
|
|||||||
if(ciphertext) {
|
if(ciphertext) {
|
||||||
const bytes = AES.decrypt(ciphertext, hashKey)
|
const bytes = AES.decrypt(ciphertext, hashKey)
|
||||||
var decryptedData = bytes.toString(enc.Utf8);
|
var decryptedData = bytes.toString(enc.Utf8);
|
||||||
if(typeof(decryptedData) != 'string') {
|
try {
|
||||||
decryptedData = JSON.parse(decryptedData)
|
return JSON.parse(decryptedData)
|
||||||
|
} catch {
|
||||||
|
return decryptedData;
|
||||||
}
|
}
|
||||||
return decryptedData;
|
|
||||||
} else {
|
|
||||||
return safe;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set(keyName, value) {
|
set(keyName, value) {
|
||||||
|
|
||||||
keyName = this.prefix + keyName
|
keyName = this.getKey(keyName)
|
||||||
|
|
||||||
if(typeof(value) != 'string') {
|
if(typeof(value) != 'string') {
|
||||||
value = JSON.stringify(value)
|
value = JSON.stringify(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user