Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: clear location and work center on company switch
Brad Barbincb716ca7dde0
diff --git a/apps/mes/app/routes/x+/company.switch.$companyId.tsx b/apps/mes/app/routes/x+/company.switch.$companyId.tsxindex 48eddfcb33..800b858d9f 100644--- a/apps/mes/app/routes/x+/company.switch.$companyId.tsx+++ b/apps/mes/app/routes/x+/company.switch.$companyId.tsx@@ -6,6 +6,7 @@ import {updateCompanySession,} from "@carbon/auth/session.server";import { redirect, type ActionFunctionArgs } from "@vercel/remix";+import { setLocationAndWorkCenter } from "~/services/location.server";import { path, requestReferrer } from "~/utils/path";export async function action({ request, params }: ActionFunctionArgs) {@@ -31,9 +32,12 @@ export async function action({ request, params }: ActionFunctionArgs) {await destroyAuthSession(request);}+ const sessionCookie = await updateCompanySession(request, companyId!);+ const locationCookie = setLocationAndWorkCenter("", "");+throw redirect(requestReferrer(request) ?? path.to.authenticatedRoot, {headers: {- "Set-Cookie": await updateCompanySession(request, companyId!),+ "Set-Cookie": `${sessionCookie} ${locationCookie}`,},});}