mardi 24 octobre 2017

How to clear a route URL when transitioning away from a route with query params?

The files route has three possible views:

  1. Shows all the files.
  2. Shows an overlay that shows matching files that were detected.
  3. Show an individual file using a query parameter.

Current issue is that when the third scenario occurs - accessing a specific file using query params like url/files?fileId=6 - and you got to another route and come back to files, the files route is now url/files?fileId=6 instead of /files.

Hunch is that this should be address using deactivate() or resetController() but haven't had much luck. Any help is appreciated!

redirect(){
    const deal = this.get('session.deal');
    if (!this.get('session.isViewer') &&
      this.get('session.matchedFiles.length') > 0){

      if(!this.get('router.url').includes('?fileId=')) {
        if(deal.get('creationStatus') === 'ready') {
          this.transitionTo('files.matches');
        }
      }

    } else {
      if (!this.get('session.isViewer') &&
        this.get('session.matchedFiles.length') === 0) {
        if(deal.get('creationStatus') === 'ready') {
          this.transitionTo('files');
        }
      }
    }
  },




Aucun commentaire:

Enregistrer un commentaire