Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

add in final places

Sara Vieiradfb0c07db0e6
diff --git a/app/routes/designer/$id.tsx b/app/routes/designer/$id.tsx
index 9f5b47485c..3babd37a9a 100644
--- a/app/routes/designer/$id.tsx
+++ b/app/routes/designer/$id.tsx
@@ -4,7 +4,7 @@ import type { Project } from "@webstudio-is/sdk";
import { Designer, links } from "~/designer";
import * as db from "~/shared/db";
import config from "~/config";
-
+import env from "~/env.server";
export { links };
export const loader: LoaderFunction = async ({ params }) => {
@@ -13,7 +13,7 @@ export const loader: LoaderFunction = async ({ params }) => {
if (project === null) {
return { errors: `Project "${params.id}" not found` };
}
- return { config, project };
+ return { config, project, env };
};
type Data = {
diff --git a/app/routes/login/index.tsx b/app/routes/login/index.tsx
index 091979a839..01938965a7 100644
--- a/app/routes/login/index.tsx
+++ b/app/routes/login/index.tsx
@@ -2,6 +2,7 @@ import { LoaderFunction, redirect } from "@remix-run/node";
import { authenticator } from "~/services/auth.server";
import config from "~/config";
+import env from "~/env.server";
import { Login, links } from "~/auth/";
@@ -13,7 +14,7 @@ export const loader: LoaderFunction = async ({ request }) => {
return redirect(config.dashboardPath);
}
- return { devLogin: process.env.DEV_LOGIN === "true" };
+ return { devLogin: process.env.DEV_LOGIN === "true", env };
};
const LoginRoute = () => {
diff --git a/app/routes/preview/$projectId.tsx b/app/routes/preview/$projectId.tsx
index 78716e32a6..d301de6831 100644
--- a/app/routes/preview/$projectId.tsx
+++ b/app/routes/preview/$projectId.tsx
@@ -2,23 +2,31 @@ import { useLoaderData } from "@remix-run/react";
import type { LoaderFunction } from "@remix-run/node";
import { Root } from "@webstudio-is/sdk";
import { loadPreviewData, type PreviewData, type ErrorData } from "~/shared/db";
+import env, { Env } from "~/env.server";
-export const loader: LoaderFunction = async ({
- params,
-}): Promise<PreviewData | ErrorData> => {
+type LoaderReturnType = Promise<
+ (PreviewData & { env: Env }) | (ErrorData & { env: Env })
+>;
+
+export const loader: LoaderFunction = async ({ params }): LoaderReturnType => {
if (params.projectId === undefined) {
- return { errors: "Missing projectId" };
+ return { errors: "Missing projectId", env };
}
try {
- return await loadPreviewData({ projectId: params.projectId });
+ const previewData = await loadPreviewData({ projectId: params.projectId });
+ return {
+ ...previewData,
+ env,
+ };
} catch (error) {
if (error instanceof Error) {
return {
errors: error.message,
+ env,
};
}
}
- return { errors: "Unexpected error" };
+ return { errors: "Unexpected error", env };
};
const PreviewRoute = () => {