diff --git a/client/src/components/support/TicketDetails.tsx b/client/src/components/support/TicketDetails.tsx index 8b77dfcf..f1b4443a 100644 --- a/client/src/components/support/TicketDetails.tsx +++ b/client/src/components/support/TicketDetails.tsx @@ -2,6 +2,7 @@ import { Label } from "semantic-ui-react"; import { SupportTicket } from "../../types"; import { format, parseISO } from "date-fns"; import { getPrettySupportTicketCategory } from "../../utils/supportHelpers"; +import { capitalizeFirstLetter } from "../util/HelperFunctions"; interface TicketDetailsProps { ticket: SupportTicket; @@ -31,6 +32,9 @@ const TicketDetails: React.FC = ({ ticket }) => {

Category: {getPrettySupportTicketCategory(ticket?.category)}

+

+ Priority: {capitalizeFirstLetter(ticket?.priority) ?? "Unknown"} +

Captured URL: {ticket?.capturedURL ? ( diff --git a/client/src/screens/conductor/support/Ticket.tsx b/client/src/screens/conductor/support/Ticket.tsx index 7f38eaf4..3be8a885 100644 --- a/client/src/screens/conductor/support/Ticket.tsx +++ b/client/src/screens/conductor/support/Ticket.tsx @@ -75,7 +75,7 @@ const SupportTicketView = () => { onSuccess: () => { window.location.href = "/support/dashboard"; queryClient.invalidateQueries(["ticket"]); - queryClient.invalidateQueries(["supportMetrics"]) + queryClient.invalidateQueries(["supportMetrics"]); }, }); @@ -89,6 +89,7 @@ const SupportTicketView = () => { ...(accessKey && { accessKey }), }, }); + if (res.data.err) { throw new Error(res.data.errMsg); } @@ -96,7 +97,16 @@ const SupportTicketView = () => { throw new Error("Invalid response from server"); } return res.data.ticket; - } catch (err) { + } catch (err: any) { + // Redirect to login if not authenticated or guest access key is invalid + if (err.response?.status === 401) { + const redirectURI = encodeURIComponent( + window.location.pathname + window.location.search + ); + const params = new URLSearchParams({ redirectURI }); + window.location.href = `/login?${params.toString()}`; + return; + } handleGlobalError(err); } }