Fixed React Query provider. Removed getSession and replaced with getUser to make Supabase happy. Fixed Stepper's responsiveness.

This commit is contained in:
giancarlo
2024-06-03 16:13:55 +07:00
parent 88cebc2126
commit b1c3f12721
5 changed files with 7748 additions and 6090 deletions

View File

@@ -5,7 +5,11 @@ import { SiteHeader } from '~/(marketing)/_components/site-header';
import { withI18n } from '~/lib/i18n/with-i18n';
async function SiteLayout(props: React.PropsWithChildren) {
const user = await getUser();
const client = getSupabaseServerComponentClient();
const {
data: { user },
} = await client.auth.getUser();
return (
<div className={'flex min-h-[100vh] flex-col'}>
@@ -19,18 +23,3 @@ async function SiteLayout(props: React.PropsWithChildren) {
}
export default withI18n(SiteLayout);
async function getUser() {
const client = getSupabaseServerComponentClient();
// Supabase is going to be complaining about this line
// since we use getSession instead of getUser
// we don't quite care because we only need to know if the user is logged in
// to display the user menu in the header.
// There is no need to ping the server while navigating to marketing pages.
const {
data: { session },
} = await client.auth.getSession();
return session?.user;
}