link-stack/apps/link/pages/tickets/urgent.tsx
2023-06-07 08:02:29 +00:00

32 lines
944 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Head from "next/head";
import useSWR from "swr";
import { NextPage } from "next";
import { Layout } from "components/Layout";
import { TicketList } from "components/TicketList";
import { getTicketsByOverviewQuery } from "graphql/getTicketsByOverviewQuery";
const Urgent: NextPage = () => {
const { data: ticketData, error: ticketError }: any = useSWR(
{
document: getTicketsByOverviewQuery,
variables: { overviewId: "gid://zammad/Overview/7" },
},
{ refreshInterval: 10000 }
);
const shouldRender = !ticketError && ticketData;
const tickets =
ticketData?.ticketsByOverview?.edges.map((edge: any) => edge.node) || [];
return (
<Layout>
<Head>
<title>Link Shell Urgent Tickets</title>
</Head>
{shouldRender && <TicketList title="Urgent" tickets={tickets} />}
{ticketError && <div>{ticketError.toString()}</div>}
</Layout>
);
};
export default Urgent;