Using AbortController with fetch-client

Hi there!

How do i use AbortController with the fetch client? Most examples say

const fetchPromise = fetch(url, {signal});

But second parameter is where i have an object for method, headers, body, etc.

:thinking:

1 Like

That is correct, signal is a property on that object

Create an abort signal and assign that signal to the signal property of the object

var controller = new AbortController();
var signal = controller.signal;
2 Likes