Add conversation requests list
- Add routes to REST API for conversation requests
- Add websocket notification on new conversation requests. This is unreliable.
- Rename 'ColoredCallButton' as 'ColoredRoundButton' and move it to Buttons file for reuse
- Review logic to show conversation tabs
- Add useConversationDisplayNameShort for conversations' names in lists. Will need more work.
- Add hooks to help managing React Query's cache
- Use React Query to remove conversations and update the cache doing so.
- Add ContactService and ConversationService as a way to group reusable functions for the server. This is inspired by jami-android
Known bug: The server often freezes on getContactFromUri (in ContactService) when a new conversation request is received.
Change-Id: I46a60a401f09c3941c864afcdb2625b5fcfe054a
diff --git a/client/src/services/contactQueries.ts b/client/src/services/contactQueries.ts
index 2b952de..5440135 100644
--- a/client/src/services/contactQueries.ts
+++ b/client/src/services/contactQueries.ts
@@ -34,6 +34,19 @@
});
};
+export const useContactQuery = (contactId?: string) => {
+ const { axiosInstance } = useAuthContext();
+
+ return useQuery({
+ queryKey: ['contacts', contactId],
+ queryFn: async () => {
+ const { data } = await axiosInstance.get<ContactDetails>(`/contacts/${contactId}`);
+ return data;
+ },
+ enabled: !!contactId,
+ });
+};
+
export const useAddContactMutation = () => {
const { axiosInstance } = useAuthContext();