title: How do I make an API call using createSlice
body: <p>I struggling to understand where I make async calls when using createSlice from redux-tookkit. I tried following the docs but got lost with all of the TypeScript stuff. (Im not using TS) I have a Login component: </p>
  
  <pre><code>import React, { useState } from "react";
  import { useSelector, useDispatch } from "react-redux";
  import {
    login,
  } from "./loginSlice";
  
  import styles from "./Login.module.css";
  
  export const Login = () =&gt; {
    const dispatch = useDispatch();
    const [email, setEmail] = useState("");
    const [password, setPassword] = useState("");
  
    const payload ={
      email: email,
      password: password
    }
  
    return (
      &lt;form&gt;
        &lt;input
          type="email"
          name="email"
          value={email}
          onChange={e =&gt; setEmail(e.target.value)}
        /&gt;
        &lt;input
          type="password"
          name="password"
          value="passwordValue"
          onChange={e =&gt; setPassword(e.target.value)}
        /&gt;
      &lt;button type="button" onClick={() =&gt; dispatch(login(payload))}&gt;Submit&lt;/button&gt;
      &lt;/form&gt;
    );
  };
  
  
  </code></pre>
  
  <p>and a login slice: </p>
  
  <pre><code>import { createSlice } from "@reduxjs/toolkit";
  
  export const slice = createSlice({
    name: "login",
    initialState: {
      email: "",
      password: "",
      user: null,
      token: null
    },
    reducers: {
      login: (state, action) =&gt; {
        console.log(action.payload.email);
        console.log(action.payload.password);
        const { email, password } = action.payload;
        state.email = email;
        state.password = password;
      },
      logout: state =&gt; {
        state.email = "";
        state.password = "";
      }
    }
  });
  
  export const { login, logout } = slice.actions;
  
  export default slice.reducer;
  </code></pre>
  
  <p>and I want to make a call to my API to fetch a token: </p>
  
  <pre><code>const authData = {
          username: email,
          password: password
      };
      let url = 'http://127.0.0.1:8080/api-token-auth/';
  
      axios.post(url, authData)
        .then(res =&gt; {
  
          if (res.status === 200) {
            console.log(res);
            const authCreds = {
              userId: res.data.pk,
              token: res.data.token,
            }
            return authCreds;
          }
          throw res;
        })
        .then(authCreds =&gt; {
          dispatch({
              type: "LOGIN",
              payload: authCreds
          })
        })
        .catch(error =&gt; {
          setIsSubmitting(false)
          setErrorMessage(error.message || error.statusText)
        });
  </code></pre>
  
  <p>Where do I go about making the call. Thanks in advance to any insight you can provide!</p>