Skip to content

useCacheableRead

useCacheableRead ​

Uses the cacheable GET route for fresh default guests. Everything else stays POST.

Types ​

ts
export function canUseCacheableGet({
  headers,
  session,
  cart,
  ssrWithoutUserContext,
}: {
  headers: Record<string, unknown>;
  session?: SessionContext;
  cart?: Schemas["Cart"];
  ssrWithoutUserContext?: boolean;
}): boolean

source code

ts
export function useCacheableRead(): UseCacheableReadReturn

source code

ts
export type UseCacheableReadReturn = {
  /**
   * Same as `apiClient.invoke` for a POST read. Uses the GET twin for fresh
   * default guests.
   */
  invokeRead: ReturnType<
    typeof createAPIClient<Pick<operations, CacheableReadOperation>>
  >["invoke"];
};

source code

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)