Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
- // const options = {
- // method: "GET",
- // headers: {
- // "X-RapidAPI-Key": "859e843ee9msh90ec6c93493a3a3p174721jsnf52bc9de51ab",
- // "X-RapidAPI-Host": "spotify23.p.rapidapi.com",
- // },
- // };
- // fetch(
- // "https://spotify23.p.rapidapi.com/tracks/?ids=4WNcduiCmDNfmTEz7JvmLv",
- // options
- // )
- // .then((response) => response.json())
- // .then((response) => console.log(response))
- // .catch((err) => console.error(err));
- export const shazamCoreApi = createApi({
- reducerPath: "shazamCoreApi",
- baseQuery: fetchBaseQuery({
- baseUrl: "https://shazam-core7.p.rapidapi.com",
- prepareHeaders: (headers) => {
- headers.set(
- "X-RapidAPI-Key",
- "859e843ee9msh90ec6c93493a3a3p174721jsnf52bc9de51ab"
- );
- return headers;
- },
- }),
- endpoints: (builder) => ({
- getAlbums: builder.query({
- query: () =>
- "/charts/get-top-songs-in_country_by_genre?country_code=GB&genre=POP",
- }),
- }),
- });
- export const { useGetAlbumsQuery } = shazamCoreApi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement