From bbf288989ffcf1fcb572e9e0cd8e56bb38949540 Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Thu, 25 Aug 2022 11:33:18 -0300 Subject: [PATCH] [FIX] Query adjustment to prevent 400 when there's no phone --- .../sidebar/footer/voip/hooks/useOmnichannelContactLabel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/meteor/client/sidebar/footer/voip/hooks/useOmnichannelContactLabel.ts b/apps/meteor/client/sidebar/footer/voip/hooks/useOmnichannelContactLabel.ts index 98ebc0d37d5c..b7df8cbcf0d1 100644 --- a/apps/meteor/client/sidebar/footer/voip/hooks/useOmnichannelContactLabel.ts +++ b/apps/meteor/client/sidebar/footer/voip/hooks/useOmnichannelContactLabel.ts @@ -8,7 +8,9 @@ export const useOmnichannelContactLabel = (caller: ICallerInfo): string => { const getContactBy = useEndpoint('GET', '/v1/omnichannel/contact.search'); const phone = parseOutboundPhoneNumber(caller.callerId); - const { data } = useQuery(['getContactsByPhone', phone], async () => getContactBy({ phone }).then(({ contact }) => contact)); + const { data } = useQuery(['getContactsByPhone', phone], async () => getContactBy({ phone }).then(({ contact }) => contact), { + enabled: !!phone, + }); return data?.name || caller.callerName || phone; };