Skip to main content

grFetch()

@gravity-rail/react


@gravity-rail/react / grFetch

Function: grFetch()

grFetch(path, init?): Promise<Response>

Same-origin fetch against the injected workspace API, usable at MODULE scope (outside a component / GravityRailProvider). Mirrors the provider's fetch; for sandboxed source sites apiBase is '' so requests stay same-origin. Use the provider's useGravityRail().fetch inside components (it honors a custom transport); this standalone form is for plain runtime code (e.g. data helpers).

Parameters​

path​

string

init?​

RequestInit = {}

Returns​

Promise<Response>