Correção do bug de frontend quando o usuario busca pela url um ticked id que não existe

pull/20/head
adriano 2023-06-20 09:17:30 -03:00
parent 40f5840edf
commit f0f49668ff
1 changed files with 13 additions and 2 deletions

View File

@ -35,7 +35,18 @@ const TicketActionButtons = ({ ticket, statusChatEnd }) => {
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [useDialogflow, setUseDialogflow] = useState(ticket.contact.useDialogflow);
// const [useDialogflow, setUseDialogflow] = useState(ticket.contact.useDialogflow);
const [useDialogflow, setUseDialogflow] = useState(() => {
if (Object.keys(ticket).length != 0) {
return ticket.contact.useDialogflow;
} else {
// Set a default value if `ticket.contact.useDialogflow` is null
return true
}
});
const ticketOptionsMenuOpen = Boolean(anchorEl); const ticketOptionsMenuOpen = Boolean(anchorEl);
const { user } = useContext(AuthContext); const { user } = useContext(AuthContext);