Middleware and iframe updates

This commit is contained in:
Darren Clarke 2023-03-01 11:02:15 +00:00
parent d7624d723f
commit ba04aa108c
29 changed files with 69 additions and 4128 deletions

View file

@ -12,18 +12,21 @@ type TicketProps = {
};
const Ticket: NextPage<TicketProps> = ({ id }) => {
const origin = typeof window !== 'undefined' && window.location.origin
? window.location.origin
: '';
const fetcher = async (url: string) => {
const res = await fetch(url);
return res.json();
}
const { data: ticketData, error: ticketError } = useSWR(
`https://redaranj-bookish-tribble-56jwjx5wh4j4w-8003.preview.app.github.dev/api/v1/tickets/${id}`,
`${origin}/api/v1/tickets/${id}`,
fetcher
);
const { data: articlesData, error: articlesError } = useSWR(
`https://redaranj-bookish-tribble-56jwjx5wh4j4w-8003.preview.app.github.dev/api/v1/ticket_articles/by_ticket/${id}`,
`${origin}/api/v1/ticket_articles/by_ticket/${id}`,
fetcher
);