feat: new "safe" procedure without unauth throwing

This commit is contained in:
Christel Westerberg
2024-07-08 14:53:48 +02:00
parent 17bc18ce2b
commit da343f45da
10 changed files with 117 additions and 69 deletions

View File

@@ -1,7 +1,6 @@
import { logout } from "@/constants/routes/handleAuth"
import { serverClient } from "@/lib/trpc/server"
import { auth } from "@/auth"
import Link from "@/components/TempDesignSystem/Link"
import { getIntl } from "@/i18n"
@@ -23,9 +22,7 @@ export default async function TopMenu({
lang,
}: TopMenuProps) {
const { formatMessage } = await getIntl()
const session = await auth()
const user = session ? await serverClient().user.get() : null
const user = await serverClient().user.name()
return (
<div className={styles.topMenu}>
<div className={styles.container}>
@@ -46,7 +43,7 @@ export default async function TopMenu({
</li>
))}
<li className={styles.sessionContainer}>
{session ? (
{user ? (
<>
{user ? (
<Link