My goal is to store all numbers retrieved from the function getWarrentsNumber() in ionic storage, but I encountered an error.
Error: The argument of type "number" cannot be assigned to type 'string'.
this.storage.set(this.NumberOfAssignedWarrents, 'LOCAL STORAGE NUMBER');
this.storage.get('name').then((name) => {
console.log('Me: Hey, ' + name + '! You have a very nice name.');
console.log('You: Thanks! I got it for my birthday.');
});
},
error => {
}
);
This function retrieves the number of tasks from the database:
getWarrentsNumber() {
let id = localStorage.getItem('userId');
this.peopleProvider.getAllWorkerAssignedWarrents(id).toPromise()
.then(result => {
this.NumberOfAssignedWarrents = result.length;
localStorage.setItem('DodNalog', result);
});
this.peopleProvider.getAllWorkerFinishedWarrents(id).toPromise()
.then(result => {
this.NumberOfFinishedWarrents = result.length;
localStorage.setItem('ZavNalog', result);
});
this.peopleProvider.getAllWorkerUnfinishedWarrents(id).toPromise()
.then(result => {
this.NumberOfUnfinishedWarrents = result.length;
localStorage.setItem('NezavNalog', result);
console.log(result);
});
}