Coin by UUID endpoint returns undefined in my console

I am able to get data for all coins. However, when I try to get details of specific coin using the uuid, it displays an error in my console yet I can’t seem to find anything wrong with my code. Can someone pls help me out. Thanks

CONSOLE ERROR:
GET https://coinranking1.p.rapidapi.com/coin?/undefined

QUERY CODE:
export const cryptoApi = createApi({
reducerPath: ‘cryptoApi’,
baseQuery: fetchBaseQuery({
baseUrl: ‘https://coinranking1.p.rapidapi.com’,
prepareHeaders: (headers) => {
headers.set(‘X-RapidAPI-Key’, ‘db843c0499mshbc424b11d14f158p130b1cjsn036a2040d96a’)
return headers;
}
}),
endpoints: (builder) => ({
getCryptos: builder.query({
query: (count) => /coins?limit=${count}
}),
getCryptoDetails: builder.query({
query: (coinuuid) => /coin?/${coinuuid}
}),
}),
});

export const { useGetCryptosQuery, useGetCryptoDetailsQuery } = cryptoApi;

1 Like

I am not sure where you are calling getCryptoDetails, but be sure to provide a coinuuid. Now you are trying to fetch the coin undefined, and our api will reply with an error that it cannot find that coin.

A uuid should look something like this: ‘Qwsogvtv82FCd’ (this is the uuid for bitcoin).

1 Like