1

I have a query that searches for an object with a given $ID. It will always fail on the initial page load as we need to wait for the user to provide this $Id. I want my query to continue retrying until a correct Id is found.

Right now the error goes straight through to the error block in subscribe. I have tried multiple approaches including refetch and retry but these don't seem to work.

Please help!

let SingleAPNObs;
let SingleAPNSub;

ngOnInit() {

// Setting up my watch parameters.
let watchVariables: WatchQueryOptions = {
                        query: GQAPNProfile,
                        variables: {
                            _id: this.singleAPN._id
                        }                        
                  };              

this.SingleAPNObs = this.apollo.watchQuery(watchVariables);

this.SingleAPNSub = this.SingleAPNObs
           .subscribe(({data,loading})=> {
                 this.singleAPN = data['apn'];
                 this.single_apn_loading = loading;
            }, (error) => {
                  console.log(error);
            });
                            
 }
viztastic
  • 1,815
  • 1
  • 17
  • 17

0 Answers0