diff --git a/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts b/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
index cca38ac87..03977bcc0 100644
--- a/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
+++ b/apps/web/app/(dashboard)/home/[account]/_lib/server/team-account-workspace.loader.ts
@@ -30,12 +30,12 @@ export const loadTeamWorkspace = cache(async (accountSlug: string) => {
accountResult,
accountsResult,
{
- data: { session },
+ data: { user },
},
] = await Promise.all([
accountPromise,
accountsPromise,
- client.auth.getSession(),
+ client.auth.getUser(),
]);
if (accountResult.error) {
@@ -63,6 +63,6 @@ export const loadTeamWorkspace = cache(async (accountSlug: string) => {
return {
account: accountData,
accounts: accountsResult.data,
- session,
+ user,
};
});
diff --git a/apps/web/app/(dashboard)/home/[account]/billing/page.tsx b/apps/web/app/(dashboard)/home/[account]/billing/page.tsx
index 6562ee9c7..325d07ad6 100644
--- a/apps/web/app/(dashboard)/home/[account]/billing/page.tsx
+++ b/apps/web/app/(dashboard)/home/[account]/billing/page.tsx
@@ -37,6 +37,7 @@ export const generateMetadata = async () => {
async function TeamAccountBillingPage({ params }: Params) {
const workspace = await loadTeamWorkspace(params.account);
const accountId = workspace.account.id;
+
const [subscription, customerId] =
await loadTeamAccountBillingPage(accountId);
diff --git a/apps/web/app/(dashboard)/home/[account]/layout.tsx b/apps/web/app/(dashboard)/home/[account]/layout.tsx
index 9ee09e07c..5cf0438ec 100644
--- a/apps/web/app/(dashboard)/home/[account]/layout.tsx
+++ b/apps/web/app/(dashboard)/home/[account]/layout.tsx
@@ -32,7 +32,7 @@ function TeamWorkspaceLayout({
collapsed={false}
account={params.account}
accounts={accounts}
- user={data.session?.user ?? null}
+ user={data?.user ?? null}
/>
}
>
diff --git a/packages/features/team-accounts/src/components/settings/team-account-danger-zone.tsx b/packages/features/team-accounts/src/components/settings/team-account-danger-zone.tsx
index f4c8fcee4..1bbc06bfb 100644
--- a/packages/features/team-accounts/src/components/settings/team-account-danger-zone.tsx
+++ b/packages/features/team-accounts/src/components/settings/team-account-danger-zone.tsx
@@ -47,14 +47,14 @@ export function TeamAccountDangerZone({
primaryOwnerUserId: string;
}>) {
- const { data: user, isLoading } = useUser();
+ const { data: user } = useUser();
- if (isLoading) {
+ if (!user) {
return ;
}
// Only the primary owner can delete the team account
- const userIsPrimaryOwner = user?.id === primaryOwnerUserId;
+ const userIsPrimaryOwner = user.id === primaryOwnerUserId;
if (userIsPrimaryOwner) {
return ;