This is my cryptoApi js file
import {createApi , fetchBaseQuery } from '@reduxjs/toolkit/query/react'
const cryptoApiHeaders = {
'X-RapidAPI-Key': 'xxxxxxxx',
'X-RapidAPI-Host': 'xxxxx'
}
const baseUrl = 'https://coinranking1.p.rapidapi.com';
const createRequest =(url) =>({url, headers: cryptoApiHeaders});
export const cryptoApi = createApi({
reducerPath: 'cryptoApi',
baseQuery: fetchBaseQuery({ baseUrl }),
endpoints: (builder) => ({
getCryptos: builder.query({
query: (count) => createRequest(`/coins?limit=${count}`),
}),
getCryptoDetails: builder.query({
query: (coinuuid) => createRequest(`/coin/${coinuuid}`),
}),
})
});
export const {
useGetCryptosQuery,useGetCryptoDetailsQuery
} = cryptoApi;
this is my API file where I'm fetching data from bing news search API (RapidAPI) and I'm able to fetch all coins data but when I tried to get the data of a single coin it throws me an error of 422