File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ "use client" ;
2+
3+ const AuthHeader = ( ) => { } ;
4+
5+ export default AuthHeader ;
Original file line number Diff line number Diff line change 1+ import { env } from "@/env.mjs" ;
2+
3+ export const getAbsoluteURL = ( path : string ) => {
4+ if ( process . env . VERCEL_URL ) {
5+ return `https://${ process . env . VERCEL_URL } ${ path } ` ;
6+ }
7+
8+ return `${ env . NEXT_PUBLIC_URL || "http://localhost:3000" } ${ path } ` ;
9+ } ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { lexicalEditor } from "@payloadcms/richtext-lexical";
99
1010import sharp from "sharp" ;
1111
12- import { env } from "@/env.mjs " ;
12+ import { getAbsoluteURL } from "@/lib/url " ;
1313
1414import { Admins } from "@/cms/collections/Admins" ;
1515import { Media } from "@/cms/collections/Media" ;
@@ -37,7 +37,7 @@ export default buildConfig({
3737 disable : true ,
3838 } ,
3939 secret : process . env . PAYLOAD_SECRET || "" ,
40- serverURL : env . NEXT_PUBLIC_URL ,
40+ serverURL : getAbsoluteURL ( "" ) ,
4141 typescript : {
4242 outputFile : path . resolve ( dirname , "payload-types.ts" ) ,
4343 } ,
Original file line number Diff line number Diff line change 11import { PayloadSDK } from "@payloadcms/sdk" ;
22
3+ import { getAbsoluteURL } from "@/lib/url" ;
4+
35import { Config } from "@/payload-types" ;
46
57// Pass your config from generated types as generic
68export const sdk = new PayloadSDK < Config > ( {
7- baseURL : ` ${ process . env . NEXT_PUBLIC_URL } /api` ,
9+ baseURL : getAbsoluteURL ( " /api" ) ,
810} ) ;
You can’t perform that action at this time.
0 commit comments