Add common app routes to the protocol renderer router (#2272)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-03-17 13:57:49 -04:00
1 parent ca39379b3a
commit 0561f6bfd0
17 files changed
+129 -33

No files matched your search

+2 -2
View File
@@ -5,11 +5,11 @@ import { clusterViewRoute, IClusterViewRouteParams } from "../components/cluster
import { navigation } from "./history";
export function navigate(location: LocationDescriptor) {
const currentLocation = navigation.getPath();
const currentLocation = navigation.location.pathname;
navigation.push(location);
if (currentLocation === navigation.getPath()) {
if (currentLocation === navigation.location.pathname) {
navigation.goBack(); // prevent sequences of same url in history
}
}
+1 -1
View File
@@ -10,5 +10,5 @@ navigation.listen((location, action) => {
const isClusterView = !process.isMainFrame;
const domain = global.location.href;
logger.debug(`[NAVIGATION]: ${action}`, { isClusterView, domain, location });
logger.debug(`[NAVIGATION]: ${action}-ing. Current is now:`, { isClusterView, domain, location });
});
-2
View File
@@ -1,10 +1,8 @@
// Navigation (renderer)
import { bindEvents } from "./events";
import { bindProtocolHandlers } from "./protocol-handlers";
export * from "./history";
export * from "./helpers";
bindEvents();
bindProtocolHandlers();
@@ -1,10 +0,0 @@
import { LensProtocolRouterRenderer } from "../protocol-handler/router";
import { navigate } from "./helpers";
export function bindProtocolHandlers() {
const lprr = LensProtocolRouterRenderer.getInstance<LensProtocolRouterRenderer>();
lprr.addInternalHandler("/preferences", () => {
navigate("/preferences");
});
}