title: useSWR - How to pass config object to fetch
body: <p>I'm trying to integrate <a href="https://swr.vercel.app/" rel="nofollow noreferrer">useSWR</a> in a next js project I'm working on.</p>
  <p>I want to pass a config to fetcher as an argument. I have read about Multiple Arguments in the <a href="https://swr.vercel.app/docs/arguments#multiple-arguments" rel="nofollow noreferrer">docs</a></p>
  <p>but it's not returning the data for some reason. it is making the api request I can see that in the network tab.</p>
  <p>not sure how to do this.</p>
  <p>any suggestions?</p>
  <pre><code>const fetcher = async (url, config) =&gt; {
    let res;
  
    if (config) {
      res = await fetch(url, config);
    } else {
      res = await fetch(url);
    }
  
    if (!res.ok) {
      const error = new Error('An error occurred while fetching the data.');
  
      error.info = await res.json();
      error.status = res.status;
      throw error;
    }
  
    return res.json();
  };
  
  const { data, error } = useSWR(
    [
      rolesUrl,
      {
        headers: {
          Authorization: `Bearer ${user.token}`,
          'Content-Type': 'application/json',
        },
      },
    ],
    fetcher
  );
  </code></pre>