-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
I have this conversationApi from where I fetch all user conversations. When user select a conversation the conversation id will be set in url, and message component will fetch the messages. But also, in other components I need to get other informations from the selected conversation. I don t want to pass props to depth (2-3 levels) and I was thinking to get conversation from rtk cache. but my question is how I do that? Should I create another endpoint getConversation or are other ways?
type ConversationQueryParams = Pick<QueryParams, 'q' | 'page'>;
export const conversationApi = api.injectEndpoints({
endpoints: (builder) => ({
getConversations: builder.query<
ConversationProps[],
ConversationQueryParams | void
>({
query: (params) => ({
url: 'http://localhost:5000/',
method: 'GET',
params: params
}),
}),
}),
overrideExisting: false,
});
export const { useGetConversationsQuery } = conversationApi;Metadata
Metadata
Assignees
Labels
No labels