feat/valid-session: check valid user/session from token instead of making a slow request to api

This commit is contained in:
Linus Flood
2024-12-17 15:15:55 +01:00
parent 431ab477eb
commit 711bf4b2d3
5 changed files with 35 additions and 15 deletions
+4 -6
View File
@@ -1,16 +1,14 @@
import { Suspense } from "react"
import { getName } from "@/lib/trpc/memoizedRequests"
import { auth } from "@/auth"
import MyPagesSidebar from "@/components/MyPages/Sidebar"
import { isValidSession } from "@/utils/session"
import SidebarNavigationSkeleton from "../MyPages/Sidebar/SidebarNavigationSkeleton"
export default async function MyPagesNavigation() {
const user = await getName()
// Check if we have user, that means we are logged in andt the My Pages menu can show.
if (!user) {
const session = await auth()
if (!isValidSession(session)) {
return null
}
return (