Hi I'm new to angular and I want to know what is the right way of repeating GET request based on the resulting data.
item.service.ts
ScanItems():Observable<any>{
return this.http.get<any>(url)
}
item.component.ts
GetScannedItems(){
this.ScanSubscription = this.itemService.ScanItems()
.subscribe(
data => {
RDate = new Date(data.Date).getTime();
const NDate = new Date().getTime();
const Diff = RDate - NDate
if(Diff > (-300000)){
console.log('Valid')
}
else {
// Repeat Request Here!!!
}
},
error => console.error(error),
() => this.ScanSubscription.unsubscribe()
)
}