Remix Utils - v9.0.0
    Preparing search index...

    Function fetchDest

    • Returns the value of the Sec-Fetch-Dest header.

      The Sec-Fetch-Dest header indicates the destination of the request and can be used to know if the request came from a fetch call or not, among other things.

      Parameters

      Returns
          | null
          | "object"
          | "image"
          | "style"
          | "document"
          | "script"
          | "audio"
          | "embed"
          | "iframe"
          | "track"
          | "video"
          | "audioworklet"
          | "font"
          | "frame"
          | "manifest"
          | "paintworklet"
          | "report"
          | "serviceworker"
          | "sharedworker"
          | "worker"
          | "xslt"
          | "empty"

      // Detect if the request came from a fetch call and return
      // json, otherwise return a redirect
      export async function action({ request }: Route.ActionArgs) {
      let dest = fetchDest(request);
      if (dest === "empty") return json(data)
      return redirect(destination)
      }
    • Returns the value of the Sec-Fetch-Dest header.

      The Sec-Fetch-Dest header indicates the destination of the request and can be used to know if the request came from a fetch call or not, among other things.

      Parameters

      Returns
          | null
          | "object"
          | "image"
          | "style"
          | "document"
          | "script"
          | "audio"
          | "embed"
          | "iframe"
          | "track"
          | "video"
          | "audioworklet"
          | "font"
          | "frame"
          | "manifest"
          | "paintworklet"
          | "report"
          | "serviceworker"
          | "sharedworker"
          | "worker"
          | "xslt"
          | "empty"

      // Detect if the request came from a fetch call and return
      // json, otherwise return a redirect
      export async function action({ request }: Route.ActionArgs) {
      let dest = fetchDest(request);
      if (dest === "empty") return json(data)
      return redirect(destination)
      }