fix: routing in admin pages

This commit is contained in:
Piyush Gupta
2025-11-19 19:22:55 +05:30
parent 16c06dacfe
commit 13450ff150
14 changed files with 33 additions and 21 deletions
+2 -1
View File
@@ -7,7 +7,8 @@ export const Route = createFileRoute("/_authenticate/_inject-org-details/admin/_
beforeLoad: ({ context }) => {
if (!context.user.superAdmin) {
throw redirect({
to: "/organization/projects"
to: "/organizations/$orgId/projects",
params: { orgId: context.organizationId }
});
}
}
@@ -122,7 +122,8 @@ export const SignupInvitePage = () => {
localStorage.setItem("orgData.id", orgId);
navigate({
to: "/organization/projects"
to: "/organizations/$orgId/projects",
params: { orgId }
});
};
@@ -72,7 +72,7 @@ export const SignUpPage = () => {
if (!serverDetails?.emailConfigured && step === 4) {
navigate({
to: "/organization/projects"
to: "/"
});
}
})();
@@ -129,7 +129,8 @@ export const UserInfoSSOStep = ({
localStorage.setItem("orgData.id", orgId);
navigate({
to: "/organization/projects"
to: "/organizations/$orgId/projects",
params: { orgId }
});
} catch (error) {
setIsLoading(false);
@@ -101,7 +101,8 @@ export const AllProjectView = ({
const handleAccessProject = async (
type: ProjectType,
projectId: string,
environments: ProjectEnv[]
environments: ProjectEnv[],
orgId: string
) => {
await orgAdminAccessProject.mutateAsync({
projectId
@@ -109,6 +110,7 @@ export const AllProjectView = ({
await navigate({
to: getProjectHomePage(type, environments),
params: {
orgId,
projectId
}
});
@@ -320,7 +322,12 @@ export const AllProjectView = ({
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
handleAccessProject(workspace.type, workspace.id, workspace.environments);
handleAccessProject(
workspace.type,
workspace.id,
workspace.environments,
workspace.orgId
);
}}
disabled={
orgAdminAccessProject.variables?.projectId === workspace.id &&
@@ -65,7 +65,8 @@ export const DeleteProjectSection = () => {
});
navigate({
to: "/organization/projects"
to: "/organizations/$orgId/projects",
params: { orgId: currentOrg.id }
});
handlePopUpClose("deleteWorkspace");
} finally {
@@ -110,7 +111,8 @@ export const DeleteProjectSection = () => {
});
navigate({
to: "/organization/projects"
to: "/organizations/$orgId/projects",
params: { orgId: currentOrg.id }
});
} finally {
setIsLeaving.off();
@@ -41,7 +41,7 @@ export const ErrorPage = ({ error }: ErrorComponentProps) => {
</a>{" "}
if the issue persists.
</p>
<Link to="/organization/projects">
<Link to="/">
<Button className="mt-4" size="xs">
<FontAwesomeIcon icon={faHome} className="mr-2" />
Back To Home
@@ -49,7 +49,7 @@ export const ProjectAccessError = () => {
<>
You are not currently a member of this project. Request access to join project.
<div className="mt-4 flex w-full justify-center gap-2">
<Link to="/organization/projects">
<Link to="/">
<Button variant="outline_bg">
<FontAwesomeIcon icon={faHome} className="mr-2" />
Back To Home
@@ -89,7 +89,7 @@ export const ProjectAccessError = () => {
project={project}
onComplete={() => {
navigate({
to: "/organization/projects"
to: "/"
});
}}
/>
@@ -16,7 +16,7 @@ export const NotFoundPage = () => {
</a>{" "}
and we`ll fix it!{" "}
</p>
<Link to="/organization/projects">
<Link to="/">
<div className="diration-200 mt-8 cursor-default rounded-md bg-mineshaft-500 px-4 py-2 font-medium hover:bg-primary hover:text-black">
Go to Dashboard
</div>
@@ -20,10 +20,7 @@ export const PersonalSettingsPage = () => {
</Helmet>
<div className="flex w-full justify-center px-6 text-white">
<div className="w-full max-w-8xl">
<Link
to="/organization/projects"
className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400"
>
<Link to="/" className="mb-4 flex items-center gap-x-2 text-sm text-mineshaft-400">
<FontAwesomeIcon icon={faChevronLeft} />
Back to Organization
</Link>