mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: added publicRuntimeConfig
This commit is contained in:
parent
a718056b93
commit
b0eee08499
@ -4,6 +4,8 @@ import { useRouter } from "next/router";
|
|||||||
|
|
||||||
import useSWRInfinite from "swr/infinite";
|
import useSWRInfinite from "swr/infinite";
|
||||||
|
|
||||||
|
import getConfig from "next/config";
|
||||||
|
|
||||||
// services
|
// services
|
||||||
import projectService from "services/project.service";
|
import projectService from "services/project.service";
|
||||||
// ui
|
// ui
|
||||||
@ -31,11 +33,13 @@ export const SelectRepository: React.FC<Props> = ({
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
|
const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig();
|
||||||
|
|
||||||
const getKey = (pageIndex: number) => {
|
const getKey = (pageIndex: number) => {
|
||||||
if (!workspaceSlug || !integration) return;
|
if (!workspaceSlug || !integration) return;
|
||||||
|
|
||||||
return `${
|
return `${
|
||||||
process.env.NEXT_PUBLIC_API_BASE_URL
|
NEXT_PUBLIC_API_BASE_URL
|
||||||
}/api/workspaces/${workspaceSlug}/workspace-integrations/${
|
}/api/workspaces/${workspaceSlug}/workspace-integrations/${
|
||||||
integration.id
|
integration.id
|
||||||
}/github-repositories/?page=${++pageIndex}`;
|
}/github-repositories/?page=${++pageIndex}`;
|
||||||
|
@ -6,6 +6,7 @@ import { Controller, useForm } from "react-hook-form";
|
|||||||
// headless ui
|
// headless ui
|
||||||
import { Dialog, Transition } from "@headlessui/react";
|
import { Dialog, Transition } from "@headlessui/react";
|
||||||
// ui components
|
// ui components
|
||||||
|
import getConfig from "next/config";
|
||||||
import {
|
import {
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
PrimaryButton,
|
PrimaryButton,
|
||||||
@ -63,9 +64,11 @@ export const PublishProjectModal: React.FC<Props> = observer(() => {
|
|||||||
const [isUnpublishing, setIsUnpublishing] = useState(false);
|
const [isUnpublishing, setIsUnpublishing] = useState(false);
|
||||||
const [isUpdateRequired, setIsUpdateRequired] = useState(false);
|
const [isUpdateRequired, setIsUpdateRequired] = useState(false);
|
||||||
|
|
||||||
const plane_deploy_url = process.env.NEXT_PUBLIC_DEPLOY_URL ?? "http://localhost:4000";
|
const { publicRuntimeConfig: { NEXT_PUBLIC_DEPLOY_URL } } = getConfig();
|
||||||
|
|
||||||
const router = useRouter();
|
const plane_deploy_url = NEXT_PUBLIC_DEPLOY_URL ?? "http://localhost:4000";
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
const { workspaceSlug } = router.query;
|
const { workspaceSlug } = router.query;
|
||||||
|
|
||||||
const store: RootStore = useMobxStore();
|
const store: RootStore = useMobxStore();
|
||||||
|
@ -8,6 +8,8 @@ import { Tooltip } from "components/ui";
|
|||||||
// hooks
|
// hooks
|
||||||
import useProjectDetails from "hooks/use-project-details";
|
import useProjectDetails from "hooks/use-project-details";
|
||||||
|
|
||||||
|
import getConfig from "next/config";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
breadcrumbs?: JSX.Element;
|
breadcrumbs?: JSX.Element;
|
||||||
left?: JSX.Element;
|
left?: JSX.Element;
|
||||||
@ -16,7 +18,7 @@ type Props = {
|
|||||||
noHeader: boolean;
|
noHeader: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const { NEXT_PUBLIC_DEPLOY_URL } = process.env;
|
const { publicRuntimeConfig: { NEXT_PUBLIC_DEPLOY_URL } } = getConfig();
|
||||||
const plane_deploy_url = NEXT_PUBLIC_DEPLOY_URL ? NEXT_PUBLIC_DEPLOY_URL : "http://localhost:3001";
|
const plane_deploy_url = NEXT_PUBLIC_DEPLOY_URL ? NEXT_PUBLIC_DEPLOY_URL : "http://localhost:3001";
|
||||||
|
|
||||||
const Header: React.FC<Props> = ({ breadcrumbs, left, right, setToggleSidebar, noHeader }) => {
|
const Header: React.FC<Props> = ({ breadcrumbs, left, right, setToggleSidebar, noHeader }) => {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// cookies
|
// cookies
|
||||||
|
import getConfig from "next/config";
|
||||||
import { convertCookieStringToObject } from "./cookie";
|
import { convertCookieStringToObject } from "./cookie";
|
||||||
// types
|
// types
|
||||||
import type { IProjectMember, IUser, IWorkspace, IWorkspaceMember } from "types";
|
import type { IProjectMember, IUser, IWorkspace, IWorkspaceMember } from "types";
|
||||||
@ -9,7 +10,9 @@ export const requiredAuth = async (cookie?: string) => {
|
|||||||
|
|
||||||
if (!token) return null;
|
if (!token) return null;
|
||||||
|
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig();
|
||||||
|
|
||||||
|
const baseUrl = NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
||||||
|
|
||||||
let user: IUser | null = null;
|
let user: IUser | null = null;
|
||||||
|
|
||||||
@ -41,7 +44,9 @@ export const requiredAdmin = async (workspaceSlug: string, projectId: string, co
|
|||||||
const cookies = convertCookieStringToObject(cookie);
|
const cookies = convertCookieStringToObject(cookie);
|
||||||
const token = cookies?.accessToken;
|
const token = cookies?.accessToken;
|
||||||
|
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig();
|
||||||
|
|
||||||
|
const baseUrl = NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
||||||
|
|
||||||
let memberDetail: IProjectMember | null = null;
|
let memberDetail: IProjectMember | null = null;
|
||||||
|
|
||||||
@ -75,7 +80,9 @@ export const requiredWorkspaceAdmin = async (workspaceSlug: string, cookie?: str
|
|||||||
const cookies = convertCookieStringToObject(cookie);
|
const cookies = convertCookieStringToObject(cookie);
|
||||||
const token = cookies?.accessToken;
|
const token = cookies?.accessToken;
|
||||||
|
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig();
|
||||||
|
|
||||||
|
const baseUrl = NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
||||||
|
|
||||||
let memberDetail: IWorkspaceMember | null = null;
|
let memberDetail: IWorkspaceMember | null = null;
|
||||||
|
|
||||||
@ -119,7 +126,8 @@ export const homePageRedirect = async (cookie?: string) => {
|
|||||||
|
|
||||||
let workspaces: IWorkspace[] = [];
|
let workspaces: IWorkspace[] = [];
|
||||||
|
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
const { publicRuntimeConfig: { NEXT_PUBLIC_API_BASE_URL } } = getConfig();
|
||||||
|
const baseUrl = NEXT_PUBLIC_API_BASE_URL || "https://api.plane.so";
|
||||||
|
|
||||||
const cookies = convertCookieStringToObject(cookie);
|
const cookies = convertCookieStringToObject(cookie);
|
||||||
const token = cookies?.accessToken;
|
const token = cookies?.accessToken;
|
||||||
|
@ -9,6 +9,10 @@ const extraImageDomains = (process.env.NEXT_PUBLIC_EXTRA_IMAGE_DOMAINS ?? "")
|
|||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
swcMinify: true,
|
swcMinify: true,
|
||||||
|
publicRuntimeConfig: {
|
||||||
|
NEXT_PUBLIC_DEPLOY_URL: process.env.NEXT_PUBLIC_DEPLOY_URL,
|
||||||
|
NEXT_PUBLIC_API_BASE_URL: process.env.NEXT_PUBLIC_API_BASE_URL
|
||||||
|
},
|
||||||
images: {
|
images: {
|
||||||
domains: [
|
domains: [
|
||||||
"vinci-web.s3.amazonaws.com",
|
"vinci-web.s3.amazonaws.com",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import dynamic from "next/dynamic";
|
import dynamic from "next/dynamic";
|
||||||
import Router from "next/router";
|
import Router from "next/router";
|
||||||
|
import App, { AppContext, AppProps } from 'next/app'
|
||||||
|
|
||||||
// themes
|
// themes
|
||||||
import { ThemeProvider } from "next-themes";
|
import { ThemeProvider } from "next-themes";
|
||||||
@ -20,8 +21,6 @@ import NProgress from "nprogress";
|
|||||||
import { UserProvider } from "contexts/user.context";
|
import { UserProvider } from "contexts/user.context";
|
||||||
import { ToastContextProvider } from "contexts/toast.context";
|
import { ToastContextProvider } from "contexts/toast.context";
|
||||||
import { ThemeContextProvider } from "contexts/theme.context";
|
import { ThemeContextProvider } from "contexts/theme.context";
|
||||||
// types
|
|
||||||
import type { AppProps } from "next/app";
|
|
||||||
// constants
|
// constants
|
||||||
import { THEMES } from "constants/themes";
|
import { THEMES } from "constants/themes";
|
||||||
// constants
|
// constants
|
||||||
@ -45,6 +44,12 @@ Router.events.on("routeChangeStart", NProgress.start);
|
|||||||
Router.events.on("routeChangeError", NProgress.done);
|
Router.events.on("routeChangeError", NProgress.done);
|
||||||
Router.events.on("routeChangeComplete", NProgress.done);
|
Router.events.on("routeChangeComplete", NProgress.done);
|
||||||
|
|
||||||
|
MyApp.getInitialProps = async (appContext: AppContext) => {
|
||||||
|
const appProps = await App.getInitialProps(appContext)
|
||||||
|
|
||||||
|
return { ...appProps }
|
||||||
|
}
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return (
|
return (
|
||||||
// <UserProvider>
|
// <UserProvider>
|
||||||
|
@ -29,6 +29,7 @@ import { useMobxStore } from "lib/mobx/store-provider";
|
|||||||
// next themes
|
// next themes
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import { IUser } from "types";
|
import { IUser } from "types";
|
||||||
|
import getConfig from "next/config";
|
||||||
|
|
||||||
// types
|
// types
|
||||||
type EmailPasswordFormValues = {
|
type EmailPasswordFormValues = {
|
||||||
@ -41,6 +42,10 @@ const HomePage: NextPage = observer(() => {
|
|||||||
const store: any = useMobxStore();
|
const store: any = useMobxStore();
|
||||||
const { setTheme } = useTheme();
|
const { setTheme } = useTheme();
|
||||||
|
|
||||||
|
const {
|
||||||
|
publicRuntimeConfig: { PROJECT_API },
|
||||||
|
} = getConfig()
|
||||||
|
|
||||||
const { isLoading, mutateUser } = useUserAuth("sign-in");
|
const { isLoading, mutateUser } = useUserAuth("sign-in");
|
||||||
|
|
||||||
const { setToastAlert } = useToast();
|
const { setToastAlert } = useToast();
|
||||||
@ -176,7 +181,7 @@ const HomePage: NextPage = observer(() => {
|
|||||||
{parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
|
{parseInt(process.env.NEXT_PUBLIC_ENABLE_OAUTH || "0") ? (
|
||||||
<>
|
<>
|
||||||
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-custom-text-100">
|
<h1 className="text-center text-2xl sm:text-2.5xl font-semibold text-custom-text-100">
|
||||||
Sign in to Plane
|
{ `Sign in to ${PROJECT_API} Plane` }
|
||||||
</h1>
|
</h1>
|
||||||
<div className="flex flex-col divide-y divide-custom-border-200">
|
<div className="flex flex-col divide-y divide-custom-border-200">
|
||||||
<div className="pb-7">
|
<div className="pb-7">
|
||||||
|
Loading…
Reference in New Issue
Block a user