Skip to content

What's rtf-query way to work with a SDK #1398

Answered by markerikson
Albert-Gao asked this question in Q&A
Discussion options

You must be logged in to vote

Hiya. Very belated response here, but I think what you're looking for is the queryFn option instead of query, which is specifically designed to let you make an arbitrary async request and return the result yourself:

https://redux-toolkit.js.org/rtk-query/usage/customizing-queries#customizing-queries-with-queryfn

If you want to see what this looks like in action, I've done some proof-of-concept work in Replay.io to use our backend SDK wrapped inside of RTK Query:

https://github.com/replayio/devtools/blob/main/packages/markerikson-stack-client-prototype/src/app/api.ts

Here's one endpoint from that file

    getSourceHitCounts: build.query<Dictionary<HitCount[]>, string>({
      queryFn: async 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Albert-Gao
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