Utilizing memoized requests

This commit is contained in:
Linus Flood
2024-10-25 15:33:06 +02:00
parent 4a8d38912f
commit 687a110a39
13 changed files with 123 additions and 91 deletions

View File

@@ -1,4 +1,4 @@
import { serverClient } from "@/lib/trpc/server"
import { getName } from "@/lib/trpc/memoizedRequests"
import LoginButton from "@/components/Current/Header/LoginButton"
import ArrowRight from "@/components/Icons/ArrowRight"
@@ -19,10 +19,10 @@ export default async function JoinLoyaltyContact({
block,
}: JoinLoyaltyContactProps) {
const intl = await getIntl()
const user = await serverClient().user.name()
const username = await getName()
// Check if we have user, that means we are logged in.
if (user) {
if (username) {
return null
}
return (

View File

@@ -1,12 +1,12 @@
import { serverClient } from "@/lib/trpc/server"
import { getName } from "@/lib/trpc/memoizedRequests"
import MyPagesSidebar from "@/components/MyPages/Sidebar"
export default async function MyPagesNavigation() {
const user = await serverClient().user.name()
const username = await getName()
// Check if we have user, that means we are logged in andt the My Pages menu can show.
if (!user) {
if (!username) {
return null
}
return <MyPagesSidebar />