mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add common app routes to the protocol renderer router (#2272)
This commit is contained in:
1 parent
ca39379b3a
commit
0561f6bfd0
17 files changed
+129
-33
No files matched your search
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user