Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RouterRootURL is not respected #415

Open
beerinho opened this issue Jul 25, 2023 · 0 comments
Open

RouterRootURL is not respected #415

beerinho opened this issue Jul 25, 2023 · 0 comments
Assignees

Comments

@beerinho
Copy link
Contributor

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 };
  }
}
@beerinho beerinho self-assigned this Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant