Issue
I'm doing my first steps with ionic and I ask me if I can use this in an ionic application:
import {LocalStorageService} from 'ngx-webstorage';
or is there a better way to store login data of user after authentification?
Solution
Ionic already provides a storage abstraction, you can use it without importing external packages.
import { Storage } from '@ionic/storage';
private store: Storage;
constructor(private storage: Storage) { }
async init() {
this.store = await this.storage.create();
}
save(userData: any) {
this.store.set('user', userData);
}
See https://github.com/ionic-team/ionic-storage for details
Answered By - Alexis Deprez
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.