Skip to content

Commit 7c1ad1e

Browse files
committed
3793 client - Redirect non-development environments away from project routes in automation
1 parent 621b07c commit 7c1ad1e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

client/src/routes.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {Connections} from '@/pages/automation/connections/Connections';
1313
import ProjectDeployments from '@/pages/automation/project-deployments/ProjectDeployments';
1414
import {AccessControl} from '@/shared/auth/AccessControl';
1515
import PrivateRoute from '@/shared/auth/PrivateRoute';
16-
import {AUTHORITIES} from '@/shared/constants';
16+
import {AUTHORITIES, DEVELOPMENT_ENVIRONMENT} from '@/shared/constants';
1717
import EEVersion from '@/shared/edition/EEVersion';
1818
import ErrorPage from '@/shared/error/ErrorPage';
1919
import LazyLoadWrapper from '@/shared/error/LazyLoadWrapper';
@@ -429,6 +429,15 @@ export const getRouter = (queryClient: QueryClient) =>
429429
</LazyLoadWrapper>
430430
</PrivateRoute>
431431
),
432+
loader: async () => {
433+
const currentEnvironmentId = environmentStore.getState().currentEnvironmentId;
434+
435+
if (currentEnvironmentId != DEVELOPMENT_ENVIRONMENT) {
436+
return redirect('/automation/deployments');
437+
}
438+
439+
return null;
440+
},
432441
path: 'projects',
433442
},
434443
{

0 commit comments

Comments
 (0)