File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 11import { Outlet } from "@remix-run/react" ;
2- import { type LoaderFunctionArgs } from "@remix-run/server-runtime" ;
2+ import { redirect , type LoaderFunctionArgs } from "@remix-run/server-runtime" ;
33import { prisma } from "~/db.server" ;
4+ import { redirectWithErrorMessage } from "~/models/message.server" ;
45import { updateCurrentProjectEnvironmentId } from "~/services/dashboardPreferences.server" ;
56import { logger } from "~/services/logger.server" ;
67import { requireUser } from "~/services/session.server" ;
7- import { EnvironmentParamSchema } from "~/utils/pathBuilder" ;
8+ import { EnvironmentParamSchema , v3ProjectPath } from "~/utils/pathBuilder" ;
89
910export const loader = async ( { request, params } : LoaderFunctionArgs ) => {
1011 const user = await requireUser ( request ) ;
@@ -47,10 +48,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
4748
4849 const environments = project . environments . filter ( ( env ) => env . slug === envParam ) ;
4950 if ( environments . length === 0 ) {
50- throw new Response ( "Environment not Found" , {
51- status : 404 ,
52- statusText : "Environment not found" ,
53- } ) ;
51+ return redirect ( v3ProjectPath ( { slug : organizationSlug } , { slug : projectParam } ) ) ;
5452 }
5553
5654 let environmentId : string | undefined = undefined ;
You can’t perform that action at this time.
0 commit comments