Skip to content

Commit

Permalink
[FIX] Query adjustment to prevent 400 when there's no phone
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Aug 25, 2022
1 parent cf82287 commit bbf2889
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit bbf2889

Please sign in to comment.