samedi 4 août 2018

Redirect Issue on refresh

I just started working with EmberJS again and encountered something that is giving me a few issues. I have a an index route and a show route defined like this.

this.route('sample-units', function() {
  this.route('show', {path: '/:id'});
});

I'm able to to load the index route with this url, http://localhost:4200/sample-units and am able to go to the show route using


  


Which gives a url like so http://localhost:4200/sample-units/1344

The issue I'm experiencing is that any time I modify show.hbs, or refresh the page, Ember reloads and redirects me back to my index route instead of staying on the show page. I've worked with ember before and never had this issue, but that was back in 2.11. Has anyone encountered this before? I would assume that it would stay on the current route when I refresh the page, but for some reason it keeps leaving the show page and reloading on the index page. My show route is pretty basic and defined like so.

import Route from '@ember/routing/route';

export default Route.extend({
  model(params) {
    return this.get('store').findRecord('sample-unit', params.id);
  }
});

Does anyone know why this might be happening? Any help would be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire