0

I am new to rtk-query and have a use case where I need an id from one service to be passed another service across the applications.

getAuthId: build.query({
            query: () => ({
                url: `/someurl`
            })
        }),
getDetails: build.query({
            query: () => ({
                url: `${authId}/url`
            })
        }),

in this use case getAuthId gives me the authId which I need to pass to all the calls subsequently.

is there any way I can do this with out using the skip as I need to use this across the application?

Madhav
  • 11
  • 1

1 Answers1

0

Not at this point. I would recommend that you abstract this into a custom hook.

export function useGetDetails(){
  const { isLoading, data } = useGetAuthIdQuery()
  return useGetDetailsQuery(data, { skip: isLoading })
}
phry
  • 35,762
  • 5
  • 67
  • 81