mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
feat: convert Chat.jsx to RQ
This commit is contained in:
parent
573112de7b
commit
1cb8ef9803
6 changed files with 53 additions and 111 deletions
|
|
@ -57,6 +57,23 @@ export const useGetConversationByIdQuery = (
|
|||
);
|
||||
}
|
||||
|
||||
//This isn't ideal because its just a query and we're using mutation, but it was the only way
|
||||
//to make it work with how the Chat component is structured
|
||||
export const useGetConversationByIdMutation = (
|
||||
id: string,
|
||||
callback: (data: t.TConversation) => void
|
||||
): UseMutationResult<t.TConversation> => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation(() => dataService.getConversationById(id),
|
||||
{
|
||||
onSuccess: (res: t.TConversation) => {
|
||||
callback(res);
|
||||
queryClient.invalidateQueries([QueryKeys.conversation, id]);
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const useUpdateConversationMutation = (
|
||||
id: string
|
||||
): UseMutationResult<
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue