2020-10-27 02:58:29 +07:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class StorageService {
|
|
|
|
getValue(key: string): string {
|
|
|
|
try {
|
|
|
|
return localStorage.getItem(key);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
2020-11-16 19:27:06 +07:00
|
|
|
return '';
|
2020-10-27 02:58:29 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setValue(key: string, value: any): void {
|
|
|
|
try {
|
|
|
|
localStorage.setItem(key, value);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|