<filename>src/api/PlayersApi.js
import { createAsyncThunk } from "@reduxjs/toolkit";

// GET ALL PLAYERS
const getPlayers = createAsyncThunk(
  "players/getPlayers",
  async () => {
    return fetch("https://free-nba.p.rapidapi.com/players?per_page=100&page=0", {
      "method": "GET",
      "headers": {
        "x-rapidapi-host": "free-nba.p.rapidapi.com",
        "x-rapidapi-key": "<KEY>"
      }
    })
    .then(async response => response.json())
    .catch(err => {
      console.error(err);
    });
  }
);
export default getPlayers