Skip to content
Snippets Groups Projects

Clean up initial router handling and add a default state

Merged Reiter, Christoph requested to merge routing-cleanup into master
3 files
+ 31
12
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -219,14 +219,21 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) {
this.router = new Router(routes, {
routeName: 'mainRoute',
getState: () => {
return {
let state = {
component: this.activeView,
lang: this.lang,
};
return state;
},
setState: (state) => {
this.updateLangIfChanged(state.lang);
this.switchComponent(state.component);
},
getDefaultState: () => {
return {
lang: 'de',
component: this.routes[0],
};
}
}, {
baseUrl: new URL(this.basePath, window.location).pathname.replace(/\/$/, ''),
Loading