title: Redux toolkit RTK query mutation not getting returning data
body: <p>Hi I recently learned the new react toolkit with the rtk query tool, and I am trying to put in a login system together using the <code>createApi</code> from the rtk package.</p>
  <p>After giving it a test on the login button pressed, I see the network request going through without any issue(status code 200), and I get a response object providing <code>user</code>, <code>token</code>, however, when I try to get the returning data using <code>useLoginMutation</code> I get an undefined value.</p>
  <p>below is the code for my endpoint which is injected in a base api:</p>
  <pre class="lang-js prettyprint-override"><code>export const apiLogin = theiaBaseApi.injectEndpoints({
    endpoints: (build) =&gt; ({
      loginUser: build.mutation&lt;UserReadonly, loginValuesType | string&gt;({
        query: (values: loginValuesType, redirect?: string) =&gt; {
          const { username, password } = values;
          const header = gettingSomeHeaderHere
  
          return {
            url: &quot;login&quot;,
            method: &quot;GET&quot;,
            headers,
            crossDomain: true,
            responseType: &quot;json&quot;,
          };
        },
      }),
    }),
  });
  
  export const { useLoginUserMutation } = apiLogin
  </code></pre>
  <p>then inside my React component I destructure the mutation result such like below:</p>
  <pre class="lang-js prettyprint-override"><code>const [login, {data, isLoading}] = useLoginUserMutation();
  
  const submitLogin = () =&gt; {
    // pass in username password from the form
    login({username, password});
  }
  </code></pre>
  <p>Suppose if I console log out <code>data</code> and <code>isLoading</code> I assume that I will see <code>data: {user: &quot;abc&quot;, token: &quot;xyz&quot;}</code>, because under network tab of my inspect window I can see the response of this network request, but instead I am seeing <code>data: undefined</code></p>
  <p>Does any have experience on solving this?</p>