Skip to content

Commit cf0be89

Browse files
committed
fix(nextjs): fix loading of env var as "undefined"
1 parent 023feee commit cf0be89

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/pages/_app.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ const App = ({ Component, pageProps, emotionCache = clientSideEmotionCache }: Cu
6262
</Head>
6363
<ThemeProviders>
6464
<UserProvider
65-
loginUrl={`${process.env.NEXT_PUBLIC_BASE_PATH}/api/auth/login`}
66-
profileUrl={`${process.env.NEXT_PUBLIC_BASE_PATH}/api/auth/me`}
65+
loginUrl={`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/auth/login`}
66+
profileUrl={`${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/auth/me`}
6767
>
6868
<QueryClientProvider client={queryClient}>
6969
<HydrationBoundary state={pageProps.dehydratedState}>

src/utils/next/ssr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { type DehydratedState } from "@tanstack/react-query";
22
import { type GetServerSidePropsContext } from "nextjs-routes";
33

44
export const getFullReturnTo = (ctx: GetServerSidePropsContext): string => {
5-
return process.env.NEXT_PUBLIC_BASE_PATH + ctx.resolvedUrl;
5+
return (process.env.NEXT_PUBLIC_BASE_PATH ?? "") + ctx.resolvedUrl;
66
};
77

88
export interface NotSuccessful {

0 commit comments

Comments
 (0)