My understanding is there should only be one createapi in your app. How would I use two basequeries in RTK query?
Ex. createApi with axiosBaseQuery
export const apiSlice = createApi({
reducerPath: "apiSlice",
baseQuery: axiosBaseQuery,
endpoints: (builder) => ({
fetchSomething: builder.query<Resource, string>({
query: (resourceUUID) => ({
url: `/services/buresource/collections/${resourceUUID}?component_level=1`,
method: "get",
}),
}),
}),
});
Ex. createapi with graphql basequery
export const api = createApi({
baseQuery: graphqlBaseQuery({
baseUrl: 'https://graphqlzero.almansi.me/api',
}),
endpoints: (builder) => ({
getPosts: builder.query({
query: () => ({
body: gql`
query {
posts {
data {
id
title
}
}
}
`,
}),
transformResponse: (response) => response.posts.data,
}),
}),
})
I'm pretty new to rtk-query and react native in general.