mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix(orpc): add Next.js server-side headers support (#550)
This commit is contained in:
@@ -33,6 +33,16 @@ export const link = new RPCLink({
|
||||
credentials: "include",
|
||||
});
|
||||
},
|
||||
{{#if (includes frontend "next")}}
|
||||
headers: async () => {
|
||||
if (typeof window !== "undefined") {
|
||||
return {}
|
||||
}
|
||||
|
||||
const { headers } = await import("next/headers")
|
||||
return Object.fromEntries(await headers())
|
||||
},
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user