feat: refactor SiteLayout to use Supabase client for user authentication
This commit is contained in:
@@ -1,13 +1,21 @@
|
|||||||
import { use } from 'react';
|
import { use } from 'react';
|
||||||
|
|
||||||
|
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
|
||||||
|
|
||||||
import { SiteFooter } from '~/(marketing)/_components/site-footer';
|
import { SiteFooter } from '~/(marketing)/_components/site-footer';
|
||||||
import { SiteHeader } from '~/(marketing)/_components/site-header';
|
import { SiteHeader } from '~/(marketing)/_components/site-header';
|
||||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||||
|
|
||||||
import { loadUserWorkspace } from '../home/(user)/_lib/server/load-user-workspace';
|
import { loadUserWorkspace } from '../home/(user)/_lib/server/load-user-workspace';
|
||||||
|
|
||||||
function SiteLayout(props: React.PropsWithChildren) {
|
async function SiteLayout(props: React.PropsWithChildren) {
|
||||||
const workspace = use(loadUserWorkspace());
|
const client = getSupabaseServerClient();
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: { user },
|
||||||
|
} = await client.auth.getUser();
|
||||||
|
|
||||||
|
const workspace = user ? use(loadUserWorkspace()) : { accounts: [] };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'flex min-h-[100vh] flex-col'}>
|
<div className={'flex min-h-[100vh] flex-col'}>
|
||||||
|
|||||||
Reference in New Issue
Block a user