i want to retrieve the data from the server using API I have to check the data has changed in server eg if the new data is added in the server that data should load into my app
i have approach -->
retrieve the data from the server and store into the storage. when the page can load again i can load data from the server but this time i have to check the data is present in the storage if its same I have to return the storage data else save the new data into the storage
this.service.loaddata().subscribe(data=>{
this.storage.get('basic').then((basic)=>{
if(JSON.stringify(data.basic)!=JSON.stringify(basic)){
this.basicDetail = data.basic;
this.storage.set('basic',data.basic);
console.log('new data comes');
}else{
this.basicDetail = basic;
console.log('old basic data')}
})
})
tell me any approach to handle new data from the server!