Skip to content

Handling side-effects of rtk queries #3101

Answered by markerikson
dbartholomae asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the endpoint matcher:

listenerMiddleware.startListening({
  matcher: api.endpoints.myEndpoint.matchFulfilled,
  effect: (action, listenerApi) => {}
})

Or if you do have an additional check:

predicate: (action) => api.endpoints.myEndpoint.matchFulfilled(action) && !action.payload.loggedIn

Replies: 1 comment 4 replies

Comment options

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

@VictorPulzz
Comment options

@jdshaeffer
Comment options

@markerikson
Comment options

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