Fetch signal (AbortController) doesn't work with Shopify Resource Fetching

Fetch signal (AbortController) doesn't work with Shopify Resource Fetching

BusyginArtem
Shopify Partner
3 0 0

I'm trying to use the Shopify Resource Fetching https://shopify.dev/docs/api/app-bridge-library/apis/resource-fetching#example-fetch-directly-from-t... with the AbortController, but it doesn't work. I pass the signal to the fetch and abort the signal, but nothing. Could you take a look at it?

const SHOPIFY_ADMIN_GRAPHQL_API = "shopify:admin/api/graphql.json";

export default async ({ query, signal = null /*, variables = {}*/ }) => {
  try {
    const response = await fetch(SHOPIFY_ADMIN_GRAPHQL_API, {
      method: "POST",
      signal,
      body: JSON.stringify({
        query,
      }),
    });

    if (!response.ok) throw new Error(response.statusText);

    return await response.json();
  } catch (error) {
    throw new Error(error);
  }

  

Replies 0 (0)