🐛 Fixing error when sending messages

This commit is contained in:
Ricardo Paes
2022-03-14 16:48:03 -03:00
parent e691be8fdf
commit d3332abe80
2 changed files with 7 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import AppError from "../../errors/AppError";
import Contact from "../../models/Contact";
import User from "../../models/User";
import Queue from "../../models/Queue";
import Whatsapp from "../../models/Whatsapp";
const ShowTicketService = async (id: string | number): Promise<Ticket> => {
const ticket = await Ticket.findByPk(id, {
@@ -22,6 +23,11 @@ const ShowTicketService = async (id: string | number): Promise<Ticket> => {
model: Queue,
as: "queue",
attributes: ["id", "name", "color"]
},
{
model: Whatsapp,
as: "whatsapp",
attributes: ["name"]
}
]
});

View File

@@ -211,7 +211,7 @@ const TicketListItem = ({ ticket }) => {
)}
</Typography>
)}
{ticket.whatsappId && (
{ticket?.whatsapp && (
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp.name}</div>
)}
</span>