The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
configurable NEXT_PUBLIC_WEBAPP_URL
Timur Ercan801548cbd6e7
diff --git a/apps/web/components/layout.tsx b/apps/web/components/layout.tsxindex 660bd2f24..c3898fe36 100644--- a/apps/web/components/layout.tsx+++ b/apps/web/components/layout.tsx@@ -3,6 +3,7 @@ import { Disclosure, Menu, Transition } from "@headlessui/react";import Link from "next/link";import { useRouter } from "next/router";import { signOut, useSession } from "next-auth/react";+import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";import Navigation from "./navigation";@@ -16,7 +17,7 @@ function useRedirectToLoginIfUnauthenticated() {router.replace({pathname: "/login",query: {- callbackUrl: `https://app.documenso.com/${location.pathname}${location.search}`,+ callbackUrl: `${NEXT_PUBLIC_WEBAPP_URL}/${location.pathname}${location.search}`,},});}diff --git a/apps/web/components/login.tsx b/apps/web/components/login.tsxindex 814f9b086..5e52f514d 100644--- a/apps/web/components/login.tsx+++ b/apps/web/components/login.tsx@@ -8,6 +8,7 @@ import { ErrorCode } from "@documenso/lib/auth";import { useState } from "react";import { useRouter } from "next/router";import { toast, Toaster } from "react-hot-toast";+import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";interface LoginValues {email: string;@@ -29,7 +30,9 @@ export default function Login() {// If not absolute URL, make it absoluteif (!/^https?:\/\//.test(callbackUrl)) {- callbackUrl = `https://app.documenso.com/${callbackUrl}`;+ if (process.env.NODE_ENV !== "production") {+ }+ callbackUrl = `${NEXT_PUBLIC_WEBAPP_URL}/${callbackUrl}`;}const onSubmit = async (values: LoginValues) => {diff --git a/apps/web/components/signup.tsx b/apps/web/components/signup.tsxindex 8479f43d6..45165479b 100644--- a/apps/web/components/signup.tsx+++ b/apps/web/components/signup.tsx@@ -1,3 +1,4 @@+import { NEXT_PUBLIC_WEBAPP_URL } from "@documenso/lib/constants";import { XCircleIcon } from "@heroicons/react/24/outline";import { signIn } from "next-auth/react";import Link from "next/link";@@ -44,7 +45,7 @@ export default function Signup() {.then(async () => {await signIn<"credentials">("credentials", {...data,- callbackUrl: "https://app.documenso.com/dashboard",+ callbackUrl: `${NEXT_PUBLIC_WEBAPP_URL}/dashboard`,});}),{diff --git a/packages/lib/constants.ts b/packages/lib/constants.tsnew file mode 100644index 000000000..2e69ab309--- /dev/null+++ b/packages/lib/constants.ts@@ -0,0 +1 @@+export const NEXT_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;diff --git a/packages/lib/index.ts b/packages/lib/index.tsindex 2314cf225..f8628cc70 100644--- a/packages/lib/index.ts+++ b/packages/lib/index.ts@@ -1,2 +1,3 @@export { coloredConsole } from "./coloredConsole";export { default as classNames } from "./classNames";+export { NEXT_PUBLIC_WEBAPP_URL } from "./constants";