mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
fix bugs vcard
[ PT-BR ] - Corrigido bug quando enviado vcard sem numero de telefone. [ US ] - Corrected bug when sent vcard without phone number.
This commit is contained in:
@@ -416,14 +416,14 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const checkMessageMedia = (message) => {
|
const checkMessageMedia = (message) => {
|
||||||
if(message.mediaType === "location" && message.body.split('|').length >= 2) {
|
if (message.mediaType === "location" && message.body.split('|').length >= 2) {
|
||||||
let locationParts = message.body.split('|')
|
let locationParts = message.body.split('|')
|
||||||
let imageLocation = locationParts[0]
|
let imageLocation = locationParts[0]
|
||||||
let linkLocation = locationParts[1]
|
let linkLocation = locationParts[1]
|
||||||
|
|
||||||
let descriptionLocation = null
|
let descriptionLocation = null
|
||||||
|
|
||||||
if(locationParts.length > 2)
|
if (locationParts.length > 2)
|
||||||
descriptionLocation = message.body.split('|')[2]
|
descriptionLocation = message.body.split('|')[2]
|
||||||
|
|
||||||
return <LocationPreview image={imageLocation} link={linkLocation} description={descriptionLocation} />
|
return <LocationPreview image={imageLocation} link={linkLocation} description={descriptionLocation} />
|
||||||
@@ -446,7 +446,7 @@ const MessagesList = ({ ticketId, isGroup }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return <VcardPreview contact={contact} numbers={obj[0].number} />
|
return <VcardPreview contact={contact} numbers={obj[0]?.number} />
|
||||||
}
|
}
|
||||||
/*else if (message.mediaType === "multi_vcard") {
|
/*else if (message.mediaType === "multi_vcard") {
|
||||||
console.log("multi_vcard")
|
console.log("multi_vcard")
|
||||||
|
|||||||
@@ -23,11 +23,12 @@ const VcardPreview = ({ contact, numbers }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const delayDebounceFn = setTimeout(() => {
|
const delayDebounceFn = setTimeout(() => {
|
||||||
const fetchContacts = async() => {
|
const fetchContacts = async () => {
|
||||||
try {
|
try {
|
||||||
let contactObj = {
|
let contactObj = {
|
||||||
name: contact,
|
name: contact,
|
||||||
number: numbers.replace(/\D/g, ""),
|
// number: numbers.replace(/\D/g, ""),
|
||||||
|
number: numbers !== undefined && numbers.replace(/\D/g, ""),
|
||||||
email: ""
|
email: ""
|
||||||
}
|
}
|
||||||
const { data } = await api.post("/contact", contactObj);
|
const { data } = await api.post("/contact", contactObj);
|
||||||
@@ -43,7 +44,7 @@ const VcardPreview = ({ contact, numbers }) => {
|
|||||||
return () => clearTimeout(delayDebounceFn);
|
return () => clearTimeout(delayDebounceFn);
|
||||||
}, [contact, numbers]);
|
}, [contact, numbers]);
|
||||||
|
|
||||||
const handleNewChat = async() => {
|
const handleNewChat = async () => {
|
||||||
try {
|
try {
|
||||||
const { data: ticket } = await api.post("/tickets", {
|
const { data: ticket } = await api.post("/tickets", {
|
||||||
contactId: selectedContact.id,
|
contactId: selectedContact.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user