mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
configurable NEXT_PUBLIC_WEBAPP_URL
This commit is contained in:
@ -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}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -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 absolute
|
||||
if (!/^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) => {
|
||||
|
||||
@ -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`,
|
||||
});
|
||||
}),
|
||||
{
|
||||
|
||||
1
packages/lib/constants.ts
Normal file
1
packages/lib/constants.ts
Normal file
@ -0,0 +1 @@
|
||||
export const NEXT_PUBLIC_WEBAPP_URL = process.env.NEXT_PUBLIC_WEBAPP_URL;
|
||||
@ -1,2 +1,3 @@
|
||||
export { coloredConsole } from "./coloredConsole";
|
||||
export { default as classNames } from "./classNames";
|
||||
export { NEXT_PUBLIC_WEBAPP_URL } from "./constants";
|
||||
|
||||
Reference in New Issue
Block a user