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