Skip to content

Commit

Permalink
fix: NEXT_PUBLIC_SERVER_ORIGIN_URL error
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Feb 28, 2024
1 parent 31cb9f0 commit 0e0b254
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions apps/web/app/trpc-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ import { toast } from 'sonner';
import { useRouter } from 'next/navigation';
import { setAuthCode } from './utils';

const NEXT_PUBLIC_SERVER_ORIGIN_URL = process.env.NEXT_PUBLIC_SERVER_ORIGIN_URL;

if (
NEXT_PUBLIC_SERVER_ORIGIN_URL === undefined ||
NEXT_PUBLIC_SERVER_ORIGIN_URL === ''
) {
throw new Error('app-err: NEXT_PUBLIC_SERVER_ORIGIN_URL is not defined!');
}
const serverOriginUrl = process.env.NEXT_PUBLIC_SERVER_ORIGIN_URL;

export function isTRPCClientError(
cause: unknown,
Expand Down Expand Up @@ -98,7 +91,7 @@ export const TrpcProvider: React.FC<{ children: React.ReactNode }> = ({
enabled: () => true,
}),
httpBatchLink({
url: NEXT_PUBLIC_SERVER_ORIGIN_URL + '/trpc',
url: serverOriginUrl + '/trpc',
async headers() {
const token = localStorage.getItem('authCode') || '';

Expand Down

0 comments on commit 0e0b254

Please sign in to comment.