Local storage service - luftsport/nlf-client GitHub Wiki
import { LocalStorage } from '@ngx-pwa/local-storage';
constructor(private storage: LocalStorage) {}
// Setter
this.storage.setItem('auth-id', data.username).subscribe(() => { });
// Getter
this.storage.getItem<String>('auth-id').subscribe(id => {
if (!!id) {
...
}
// Clear
this.storage.clear().subscribe(() => {}));
this.storage.getItem('auth-id').subscribe(person_id => {
this.membership.getUser(this.id).subscribe(
data => {...}
);
});
this.activity = this.storage.getItem<number>('default-activity');
and
{{ activity | async }}
import { NlfLocalStorageService } from 'app/services/storage/local-storage.service';
...
constructor(private storage: NlfLocalStorageService) {}
Then use it as
- getId()
- getSettings()
- getSetting('default_club')