title: I was unable to make a post request with Redux-Toolkit RTK Query
body: <p>I started learning RTK Query few days ago, and I would like to make a post request to my backend. But for some reason, my backend is not accepting the data from my frontend and I keep getting an error that says name, email and password is incorrect. Nothing is wrong with my backend because I was using useContext before and everything works fine.</p>
  <p>Here is my where I made the request</p>
  <pre><code>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt;
  
  
  import { createApi } from &quot;@reduxjs/toolkit/query/react&quot;;
  import axiosBaseQuery from &quot;./axiosBaseQuery&quot;;
  
  export const fetcherApi = createApi({
    reducerPath: &quot;fetcherApi&quot;,
    baseQuery: axiosBaseQuery({
      baseUrl: &quot;http://localhost:5000/&quot;,
    }),
    endpoints(build) {
      return {
        registerUser: build.mutation({
        //I tried putting the &quot;form&quot; inside a curly braces bracket, it still keep throwing error
          query: (form) =&gt; ({
            url: &quot;register&quot;,
            method: &quot;post&quot;,
            body: form,
            headers: {
              &quot;Content-type&quot;: &quot;application/json; charset=UTF-8&quot;,
            },
          }),
        }),
      };
    },
  });
  
  export const {
    useRegisterUserMutation,
  } = fetcherApi;
  </code></pre>
  <p>Here is my frontend, where I was passing the data. I submitted the form in the submitUser function</p>
  <pre><code>&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js&quot;&gt;&lt;/script&gt;
  
  import Link from &quot;next/link&quot;;
  import React, { useState } from &quot;react&quot;;
  import { AiOutlineCar } from &quot;react-icons/ai&quot;;
  import { BsEye, BsEyeSlash } from &quot;react-icons/bs&quot;;
  import { useRouter } from &quot;next/router&quot;;
  import { useRegisterUserMutation } from &quot;@/store/ReduxStore/fetcherApi&quot;;
  
  function Login() {
    const [registerUser] = useRegisterUserMutation();
  
    const [showPassword, setShowPassword] = useState(&quot;password&quot;);
    const [name, setName] = useState(&quot;&quot;);
    const [nameError, setNameError] = useState(&quot;&quot;);
    const [email, setEmail] = useState(&quot;&quot;);
    const [emailError, setEmailError] = useState(&quot;&quot;);
  
    const [password, setPassword] = useState(&quot;&quot;);
    const [passwordOneError, setPasswordOneError] = useState(&quot;&quot;);
    const [secPassword, setSecPassword] = useState(&quot;&quot;);
    const [secPasswordError, setSecPasswordError] = useState(&quot;&quot;);
  
    const router = useRouter();
    const form = {
      name,
      email,
      password,
    };
  
    const nameChange = (e) =&gt; {
      setName(e.target.value);
      e.target.value &lt; 1 ? setNameError(&quot;Name is required&quot;) : setNameError(&quot;&quot;);
    };
  
    const emailChange = (e) =&gt; {
      setEmail(e.target.value);
      e.target.value &lt; 1 ? setEmailError(&quot;Name is required&quot;) : setEmailError(&quot;&quot;);
    };
  
    const passwordOneChange = (e) =&gt; {
      setPassword(e.target.value);
      e.target.value &lt; 1
        ? setPasswordOneError(&quot;Name is required&quot;)
        : setPasswordOneError(&quot;&quot;);
    };
  
    const passwordTwoChange = (e) =&gt; {
      setSecPassword(e.target.value);
      e.target.value &lt; 1
        ? setSecPasswordError(&quot;Name is required&quot;)
        : setSecPasswordError(&quot;&quot;);
  
      e.target.value !== password
        ? setSecPasswordError(&quot;Password didnot match&quot;)
        : setSecPasswordError(&quot;&quot;);
    };
  
    const showPasswordHandler = () =&gt; {
      if (showPassword === &quot;password&quot;) {
        setShowPassword(&quot;text&quot;);
      } else {
        setShowPassword(&quot;password&quot;);
      }
    };
  
    const submitUser = async (e) =&gt; {
      e.preventDefault();
      secPassword !== password
        ? setSecPasswordError(&quot;Password didnot match&quot;)
        : setSecPasswordError(&quot;&quot;);
  
      //form was submitted here
      await registerUser(form);
  
      router.push(&quot;/profile&quot;);
    };
  
    const thedate = new Date();
    const year = thedate.getFullYear();
  
    return (
      &lt;div className=&quot;authbackground&quot;&gt;
        &lt;div className=&quot;flex flex-col mt-3 mx-auto w-4/5  items-center justify-center&quot;&gt;
          &lt;div className=&quot;flex-shrink-0 cursor-default p-2 flex items-center&quot;&gt;
            &lt;AiOutlineCar className=&quot;text-8xl mx-auto text-blue-400&quot; /&gt;
            &lt;h1 className=&quot;text-white text-6xl mx-auto font-logo-font&quot;&gt;Big-C&lt;/h1&gt;
          &lt;/div&gt;
          &lt;div className=&quot;bg-white shadow rounded xl:w-1/3  md:w-1/2 w-full p-10 mt-16&quot;&gt;
            &lt;p
              aria-label=&quot;Login to your account&quot;
              className=&quot;text-2xl font-extrabold leading-6 text-gray-800&quot;
            &gt;
              Create an account
            &lt;/p&gt;
  
            &lt;form onSubmit={submitUser}&gt;
              &lt;div className=&quot;mt-5&quot;&gt;
                &lt;label htmlFor=&quot;name&quot; className=&quot;authformlabel&quot;&gt;
                  Name
                &lt;/label&gt;
                {/*_________Name_______*/}
                &lt;input
                  placeholder=&quot;Enter email adress&quot;
                  type=&quot;name&quot;
                  className=&quot;authform&quot;
                  onChange={nameChange}
                  value={name}
                  onBlur={() =&gt;
                    name &lt; 1 ? setNameError(&quot;Name is required&quot;) : setNameError(&quot;&quot;)
                  }
                /&gt;
                &lt;p className=&quot;formerror&quot;&gt;{nameError}&lt;/p&gt;
              &lt;/div&gt;
              &lt;div className=&quot;mt-5&quot;&gt;
                &lt;label htmlFor=&quot;email&quot; className=&quot;authformlabel&quot;&gt;
                  Email
                &lt;/label&gt;
                {/*_________Email_______*/}
                &lt;input
                  placeholder=&quot;Enter email adress&quot;
                  type=&quot;email&quot;
                  className=&quot;authform&quot;
                  onChange={emailChange}
                  value={email}
                  onBlur={() =&gt;
                    email &lt; 1
                      ? setEmailError(&quot;Email is required&quot;)
                      : setEmailError(&quot;&quot;)
                  }
                /&gt;
                &lt;p className=&quot;formerror&quot;&gt;{emailError}&lt;/p&gt;
              &lt;/div&gt;
              &lt;div className=&quot;mt-6  w-full&quot;&gt;
                &lt;label htmlFor=&quot;passwordOne&quot; className=&quot;authformlabel&quot;&gt;
                  Password
                &lt;/label&gt;
                &lt;div className=&quot;showpasswordicon&quot;&gt;
                  {/*_________PasswordOne_______*/}
                  &lt;input
                    placeholder=&quot;Enter Password&quot;
                    type={showPassword}
                    className=&quot;authform&quot;
                    onChange={passwordOneChange}
                    value={password}
                    onBlur={() =&gt;
                      password &lt; 1
                        ? setPasswordOneError(&quot;Password is required&quot;)
                        : setPasswordOneError(&quot;&quot;)
                    }
                  /&gt;
  
                  &lt;button
                    type=&quot;button&quot;
                    onClick={showPasswordHandler}
                    className=&quot;formshowpassword&quot;
                  &gt;
                    {showPassword === &quot;password&quot; &amp;&amp; &lt;BsEye /&gt;}
                    {showPassword === &quot;text&quot; &amp;&amp; &lt;BsEyeSlash /&gt;}
                  &lt;/button&gt;
                &lt;/div&gt;
                &lt;p className=&quot;formerror&quot;&gt;{passwordOneError}&lt;/p&gt;
                &lt;label htmlFor=&quot;passwordTwo&quot; className=&quot;authformlabel&quot;&gt;
                  Re-type Password
                &lt;/label&gt;
                &lt;div className=&quot;showpasswordicon&quot;&gt;
                  {/*_________PasswordTwo_______*/}
                  &lt;input
                    placeholder=&quot;Re-enter Password&quot;
                    type={showPassword}
                    className=&quot;authform&quot;
                    onChange={passwordTwoChange}
                    value={secPassword}
                    onBlur={() =&gt;
                      secPassword &lt; 1
                        ? setSecPasswordError(&quot;Password is required&quot;)
                        : setSecPasswordError(&quot;&quot;)
                    }
                  /&gt;
  
                  &lt;button
                    type=&quot;button&quot;
                    onClick={showPasswordHandler}
                    className=&quot;formshowpassword&quot;
                  &gt;
                    {showPassword === &quot;password&quot; &amp;&amp; &lt;BsEye /&gt;}
                    {showPassword === &quot;text&quot; &amp;&amp; &lt;BsEyeSlash /&gt;}
                  &lt;/button&gt;
                &lt;/div&gt;
                &lt;p className=&quot;formerror&quot;&gt;{secPasswordError}&lt;/p&gt;
              &lt;/div&gt;
              &lt;div className=&quot;mt-8&quot;&gt;
                &lt;button aria-label=&quot;create my account&quot; className=&quot;authformbutton&quot;&gt;
                  Create an account
                &lt;/button&gt;
              &lt;/div&gt;
            &lt;/form&gt;
            &lt;p className=&quot;text-sm mt-4 font-medium leading-none text-gray-500&quot;&gt;
              Already have an account?{&quot; &quot;}
              &lt;span
                role=&quot;link&quot;
                className=&quot;text-sm font-medium leading-none underline text-gray-800 cursor-pointer&quot;
              &gt;
                &lt;Link href=&quot;/login&quot;&gt;Login here&lt;/Link&gt;
              &lt;/span&gt;
            &lt;/p&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;footer className=&quot;py-16 flex flex-col justify-center items-center&quot;&gt;
          &lt;p className=&quot;mt-2 text-xs xl:text-sm leading-none text-gray-50&quot;&gt;
            &lt;span&gt;{year}&lt;/span&gt; Big-C. All Rights Reserved.
          &lt;/p&gt;
        &lt;/footer&gt;
      &lt;/div&gt;
    );
  }
  
  export default Login;
  </code></pre>
  <p>Pls kindly help me out. Thanks</p>