Email redirect and group dropdown fixes

This commit is contained in:
Darren Clarke 2024-11-25 11:48:19 +01:00
parent 7ad25e8a95
commit 84731c9e9a
5 changed files with 24 additions and 14 deletions

View file

@ -1,6 +1,7 @@
"use client";
import { FC, useEffect, useState } from "react";
import { redirect } from "next/navigation";
import { getOverviewTicketsAction } from "app/_actions/overviews";
import { TicketList } from "./TicketList";
@ -12,6 +13,17 @@ type ZammadOverviewProps = {
export const ZammadOverview: FC<ZammadOverviewProps> = ({ name }) => {
const [tickets, setTickets] = useState([]);
useEffect(() => {
const hash = window?.location?.hash;
if (hash) {
const ticketID = hash.replace("#ticket/zoom/", "");
if (ticketID && !isNaN(parseInt(ticketID, 10))) {
redirect(`/tickets/${ticketID}`);
}
}
}, [window?.location?.hash]);
useEffect(() => {
const fetchTickets = async () => {
const { tickets } = await getOverviewTicketsAction(name);