ignore of ping in support sse
This commit is contained in:
parent
abcdbe4225
commit
2ab2bf909b
@ -26,6 +26,7 @@ export interface Ticket {
|
||||
title: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
system?: boolean;
|
||||
rate: number;
|
||||
}
|
||||
|
||||
|
@ -33,10 +33,15 @@ export default function Support() {
|
||||
onFetchStateChange: setTicketsFetchState,
|
||||
});
|
||||
|
||||
useSSESubscription<Ticket>({
|
||||
useSSESubscription<Ticket | [{event: "ping"}]>({
|
||||
enabled: Boolean(token),
|
||||
url: process.env.REACT_APP_DOMAIN + `/heruvym/v1.0.0/subscribe?Authorization=${token}`,
|
||||
onNewData: updateTickets,
|
||||
onNewData: (e) => {
|
||||
|
||||
if ("event" in e[0] && e[0].event === "ping") return
|
||||
|
||||
updateTickets(e as Ticket[])
|
||||
},
|
||||
onDisconnect: () => {
|
||||
clearMessageState();
|
||||
clearTickets();
|
||||
|
@ -22,12 +22,13 @@ export default function TicketItem({ ticket, setActiveUserId }: Props) {
|
||||
const navigate = useNavigate();
|
||||
const ticketId = useParams().ticketId;
|
||||
|
||||
const isUnread = ticket.user === ticket.top_message.user_id;
|
||||
console.log(ticket)
|
||||
const isUnread = ticket.user === ticket?.top_message?.user_id;
|
||||
const isSelected = ticket.id === ticketId;
|
||||
|
||||
const unreadSx = {
|
||||
border: "1px solid",
|
||||
borderColor: theme.palette.golden.main,
|
||||
borderColor: ticket.system ? "red" : theme.palette.golden.main,
|
||||
backgroundColor: theme.palette.goldenMedium.main,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user