19 行
548 B
TypeScript
19 行
548 B
TypeScript
export type RenderContext = {
|
|
pathname: string
|
|
origin: string
|
|
apiBaseURL?: string
|
|
cookie?: string
|
|
setCookies?: string[]
|
|
csrf?: { token?: string; pending?: Promise<string> }
|
|
forwardedFor?: string
|
|
status?: number }
|
|
|
|
|
|
// The server build replaces this module with the AsyncLocalStorage implementation.
|
|
export const currentRenderContext = (): RenderContext | undefined => {
|
|
if (typeof window === 'undefined')
|
|
return undefined
|
|
return { pathname: window.location.pathname,
|
|
origin: window.location.origin }
|
|
}
|