I'm working on my home.ts file and I need to use localStorage items when the internet connection is offline. However, I am encountering numerous errors when trying to add an IF condition in my code. Specifically, I want to access the getItem method below for '__mydb/_ionickv/DodNalog' if the internet is not available.
getStorageWarents() {
this.storage.ready()
.then(() => {
this.warrentsInStorage = JSON.parse(localStorage.getItem('__mydb/_ionickv/DodNalog'));
console.log("Warrents in storage: ", this.warrentsInStorage);
})
.then(() => {
this.getAssignedWarrents();
})
.then(() => {
this.getAllGoods();
})
.then(() => {
this.getAllCancelTypes();
})
.then(() => {
this.getAllDeviceTypes();
})
.then(() => {
this.getAllManufacturers();
})
.then(() => {
this.getAllIntereventionTypes();
})
}