Page reload on push

I’m recieving push notifications and registering it in app.component.
Problem: i want on recieved push message ( pressed OK ) to go to HomePage. On HomePage after ionViewDidEnter im calling api for new data. How to reload HomePage after push if HomePage is already open so i can trigger ionViewDidEnter againt so api can be called again? it all works if push is recieved on every other page

  async pushNotification(message) {
    const alert = await this.alertCtrl.create({
      header: message,
      buttons: [
        {
          text: 'OK',
          handler: (data) => {          
  
          
              } else {
                
                this.router.navigateByUrl('/login');
              }  
          }
        }
      ]
    });
    await alert.present();
  }

Hello,

Have you tried to call window.location.reload()?

This is IMHO your underlying problem. Lifecycle events are a bad fit for dealing with data freshness.

Respecfully, this is a terrible suggestion. It causes the entire app to be restarted from scratch - way too heavy an operation for what is needed here.

1 Like