fix: added routing redirects with splat

This commit is contained in:
Piyush Gupta
2025-11-20 20:46:25 +05:30
parent e022f730ea
commit 14019b5437
4 changed files with 77 additions and 15 deletions
@@ -14,8 +14,11 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details/organiz
const remainingPath = params._splat || "";
throw redirect({
to: `/organizations/$orgId/${remainingPath}` as const,
params: { orgId },
to: "/organizations/$orgId/$",
params: {
orgId,
_splat: remainingPath ?? ""
},
search
});
}
@@ -1,7 +1,5 @@
import { createFileRoute, redirect } from "@tanstack/react-router";
import { localStorageService } from "@app/helpers/localStorage";
export const Route = createFileRoute("/_authenticate/_inject-org-details/projects/$")({
beforeLoad: ({ context, params, search }) => {
const orgId = context.organizationId;
@@ -14,18 +12,10 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details/project
// eslint-disable-next-line no-underscore-dangle
const remainingPath = params._splat || "";
const projectId = localStorageService.getIintegrationProjectId();
if (!projectId) {
throw redirect({
to: "/organizations/$orgId/projects",
params: { orgId }
});
}
throw redirect({
to: `/organizations/$orgId/projects/${remainingPath}` as const,
params: { orgId, projectId },
to: "/organizations/$orgId/projects/$" as const,
params: { orgId, _splat: remainingPath },
search
});
}