From ce0927d77d1d45ec37e6e99e87b0812d332d67c0 Mon Sep 17 00:00:00 2001 From: jakeaturner Date: Tue, 19 Mar 2024 09:44:41 -0700 Subject: [PATCH 1/2] fix(Support): add priority to ticket detail pane --- client/src/components/support/TicketDetails.tsx | 4 ++++ 1 file changed, 4 insertions(+) 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 ? ( From f36b3d5160a6a470d00837e94d1dfbcf6cb234a4 Mon Sep 17 00:00:00 2001 From: jakeaturner Date: Tue, 19 Mar 2024 11:09:56 -0700 Subject: [PATCH 2/2] fix(Support): redirect user to login as necessary --- client/src/screens/conductor/support/Ticket.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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); } }