• 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 FetchDest | null

    // Detect if the request came from a fetch call and return
    // json, otherwise return a redirect
    export async function action({ request }: ActionFunctionArgs) {
    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 FetchDest | null

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