Viewing the ticket details
We now want to display all ticket information from the database on the Ticket Details page. Right now, TicketDetailsPage
is a server component – that’s okay, as it allows us to fetch the ticket information with the page request and show it. So, let’s start doing that.
Firstly, we require a Supabase client that respects RLS and is bound to the user. It’s crucial to emphasize the significance of using a user-bound client here again. While we could instantiate an admin client within a server component, doing so would disregard all RLS policies and permissions. Therefore, let’s ensure that we fetch the data using an RLS-respecting client within the tickets/details/[id]/page.js
file:
export default async function TicketDetailsPage({ params }) { const supabase = getSupabaseCookiesUtilClient(); const id = Number(params.id); const { data: ticket, error } = await supabase ...