fix change namespace
@@ -7,14 +7,11 @@ export const setCurrentNamespaceAction = (namespace: string, redirect: boolean =
if (redirect) {
const pathname = window.location.pathname;
const pathnameSplits = pathname.split("/");
- // eg. "/applications/app1/components/component1".split("/")
- // => ["", "applications", "app1", "components", "component1"]
+ // eg. "/applications/app1/components/component1/edit".split("/")
+ // => ["", "applications", "app1", "components", "component1", "edit"]
if (pathnameSplits[1] && pathnameSplits[2] && pathnameSplits[1] === "applications") {
pathnameSplits[2] = namespace;
- if (pathnameSplits[4]) {
- pathnameSplits[4] = "";
- }
- dispatch(push(pathnameSplits.join("/")));
+ dispatch(push(pathnameSplits.slice(0, 4).join("/")));
}
}
