Skip to content

RouterRootURL is not respected #415

Open
@beerinho

Description

@beerinho

I'm working on a project that has a requirement to use RouterRootURL, but the issue is that ember-error-route only cares about the rootURL set in the environment, rather than the one that is set in the Router.

Consideration - would this impact fastboot?

import ErrorRoute from 'ember-error-route';
import { service } from '@ember/service';

export default class CustomErrorRoute extends ErrorRoute {
  @service router;

  setupController(controller, error) {
    super.setupController(...arguments);
    console.error(error);
  }

  serialize({ transition }) {
    let path = this.urlForRouteInfo(transition.to);

    const rootURL = this.router.rootURL;

    if (path.startsWith(rootURL)) {
      path = path.slice(rootURL.length);
    }

    return { path };
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions