Closed shaunluttin closed 7 years ago
The error is related to our login
route.
{
name: "login", nav: false, navigationStrategy: () => this.openIdConnect.login(), route: "login",
settings: { roles: [OpenIdConnectRoles.Anonymous] },
},
The aurelia-templating-router is loading it like this. The config.moduleId
is undefined, though, and so _aureliaPath.relativeToFile()
throws the above error.
TemplatingRouteLoader.prototype.loadRoute = function loadRoute(router, config) {
var childContainer = router.container.createChild();
var instruction = {
viewModel: (0,
_aureliaPath.relativeToFile)(
config.moduleId,
_aureliaMetadata.Origin.get(router.container.viewModel.constructor).moduleId),
childContainer: childContainer,
view: config.view || config.viewStrategy,
Changing the navigationStrategy to set its moduleId
to an empty string resolved the issue. @EisenbergEffect.
{
name: "login",
nav: false,
navigationStrategy: (instruction) => {
instruction.config.href = instruction.fragment;
instruction.config.moduleId = instruction.fragment;
this.openIdConnect.login();
},
route: "login",
settings: { roles: [OpenIdConnectRoles.Anonymous] },
},
The final resolution is to set href
, moduleId
, and redirect
.
{
name: "login",
nav: false,
navigationStrategy: (instruction) => {
instruction.config.href = instruction.fragment;
instruction.config.moduleId = instruction.fragment;
instruction.config.redirect = instruction.fragment;
this.openIdConnect.login();
},
route: "login",
settings: {
roles: [OpenIdConnectRoles.Anonymous]
},
},
Click login in Google Chrome. The page correctly navigates to the authorization server, and also throws this error: