Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Functions

createUploadBody

  • createUploadBody(data: Record<string, Blob>): FormData
  • Parameters

    • data: Record<string, Blob>

    Returns FormData

extractSingleResource

  • Extracts a single resource from a resource collection, i.e. a NationCollection. This allows us to maximize the use of the cached requests made by SWR. Instead of fetching the resources again, separately, we fetch the entire collection once and extracts the resource that we want from the array.

    This also comes with the benefit of automatically invalidating data that uses single resources. Without this, invalidating the entire collection would not automatically invalidate the single resource, since it was fetched using a unique key.

    Type parameters

    • R

    • T: R[]

    • K: string | number | symbol

    Parameters

    Returns ExtractedCachedAsyncHookContract<R, T>

removeCallback

  • removeCallback<T>(array: T[], cb: T): void
  • Type parameters

    • T

    Parameters

    • array: T[]
    • cb: T

    Returns void

Generated using TypeDoc