Skip to content

injectEndpoints does not have tags? [edited] #2568

Answered by phryneas
samislam asked this question in Q&A
Discussion options

You must be logged in to vote

you got the nesting wrong and there is no plain "tags" option

const roomSlice = mainApi
+.enhanceEndpoints({
+  addTagTypes: ['rooms'],
+})
.injectEndpoints({
-  tags: ['rooms'],
  endpoints: (builder) => ({
    getMany: builder.query({
      query: () => ({
        url: `/rooms`,
-       providesTags: ['rooms'],
      }),
+    providesTags: ['rooms'],
    }),
    createOne: builder.mutation({
      query: (payload) => ({
        url: '/rooms',
        method: 'POST',
        body: payload,
-      invalidatesTags: ['rooms'],
      }),
+    invalidatesTags: ['rooms'],
    }),
  }),
})

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@samislam
Comment options

@samislam
Comment options

@phryneas
Comment options

@samislam
Comment options

Answer selected by samislam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants