Account Workspace API | React Router Supabase Turbo

The account workspace API allows you to retrieve all the data related to the current account.

When within the layout /home/[account] - you have access to data fetched from the account workspace API.

The data in this layout has most of the information you need around the currently selected account and the user.

To access this data, you can use the useRouterLoaderData hook.

import { useRouteLoaderData } from 'react-router';
import type { Route as AccountWorkspaceRoute } from '~/types/app/routes/home/account/+types/layout';
export default function Layout() {
const { workspace } = useRouteLoaderData(
'routes/home/account/layout',
) as AccountWorkspaceRoute.ComponentProps['loaderData'];
// use workspace
}
This data is only available in the `/home/[account]` layout.