fix(SW-556): now fetching surprises separately in component.
also showing surprises on any account page
This commit is contained in:
25
components/MyPages/Surprises/index.tsx
Normal file
25
components/MyPages/Surprises/index.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import SurprisesNotification from "./SurprisesNotification"
|
||||
|
||||
export default async function Surprises() {
|
||||
const user = await getProfile()
|
||||
|
||||
if (!user || "error" in user) {
|
||||
return null
|
||||
}
|
||||
|
||||
const surprises = await serverClient().contentstack.rewards.surprises()
|
||||
|
||||
if (!surprises) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<SurprisesNotification
|
||||
surprises={surprises}
|
||||
membershipNumber={user.membership?.membershipNumber}
|
||||
/>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user