feat/valid-session: check valid user/session from token instead of making a slow request to api
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user