Minimal createApi shape
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
export const api = createApi({
reducerPath: "api",
baseQuery: fetchBaseQuery({ baseUrl: "/api" }),
endpoints: (build) => ({
getTickets: build.query<Ticket[], void>({
query: () => "/tickets",
}),
createTicket: build.mutation<Ticket, NewTicket>({
query: (body) => ({ url: "/tickets", method: "POST", body }),
}),
}),
});
export const { useGetTicketsQuery, useCreateTicketMutation } = api;
// Also add api.reducer + api.middleware to configureStoreValid RTK Query. apps/web Nest path uses Axios + TanStack Query — know both.