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

32 lines
949 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 Pending: NextPage = () => {
const { data: ticketData, error: ticketError }: any = useSWR(
{
document: getTicketsByOverviewQuery,
variables: { overviewId: "gid://zammad/Overview/3" },
},
{ refreshInterval: 10000 }
);
const shouldRender = !ticketError && ticketData;
const tickets =
ticketData?.ticketsByOverview?.edges.map((edge: any) => edge.node) || [];
return (
<Layout>
<Head>
<title>Link Shell Assigned Tickets</title>
</Head>
{shouldRender && <TicketList title="Pending" tickets={tickets} />}
{ticketError && <div>{ticketError.toString()}</div>}
</Layout>
);
};
export default Pending;