Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Skip router render meanwhile there is no outlet
Browse files Browse the repository at this point in the history
  • Loading branch information
abdonrd committed Nov 25, 2020
1 parent c6f4576 commit 4c6b331
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ import { routes } from './routes';

const router = new Router();

router.setRoutes([
// Redirect to URL without trailing slash
{
path: '(.*)/',
action: (context, commands) => {
const newPath = context.pathname.slice(0, -1);
return commands.redirect(newPath);
}
},
...routes
]);
router.setRoutes(
[
// Redirect to URL without trailing slash
{
path: '(.*)/',
action: (context, commands) => {
const newPath = context.pathname.slice(0, -1);
return commands.redirect(newPath);
}
},
...routes
],
true
);

export const attachRouter = (outlet: HTMLElement) => {
router.setOutlet(outlet);
router.render(window.location, true);
};

export const urlForName = (name: string, params?: Params) => {
Expand Down

0 comments on commit 4c6b331

Please sign in to comment.