fix(LOY-64): memoize getCurrentRewards call
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { getMembershipLevel } from "@/lib/trpc/memoizedRequests"
|
import {
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
getCurrentRewards,
|
||||||
|
getMembershipLevel,
|
||||||
|
} from "@/lib/trpc/memoizedRequests"
|
||||||
|
|
||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import SectionHeader from "@/components/Section/Header"
|
import SectionHeader from "@/components/Section/Header"
|
||||||
@@ -16,7 +18,7 @@ export default async function CurrentRewardsBlock({
|
|||||||
link,
|
link,
|
||||||
}: AccountPageComponentProps) {
|
}: AccountPageComponentProps) {
|
||||||
const [rewardsResponse, membershipLevel] = await Promise.all([
|
const [rewardsResponse, membershipLevel] = await Promise.all([
|
||||||
serverClient().contentstack.rewards.current(),
|
getCurrentRewards(),
|
||||||
getMembershipLevel(),
|
getMembershipLevel(),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -148,3 +148,9 @@ export const getCityCoordinates = cache(
|
|||||||
return serverClient().hotel.map.city(input)
|
return serverClient().hotel.map.city(input)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export const getCurrentRewards = cache(
|
||||||
|
async function getMemoizedCurrentRewards() {
|
||||||
|
return serverClient().contentstack.rewards.current()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user