Merged in feature/SW-3505-fetch-eurobonus-points (pull request #2847)

feat(SW-3505): add endpoint for getting eurobonus profile

* feat(SW-3505): add endpoint for getting eurobonus profile

* make sure we add loginType to session

* no need to run zod parsing twice

* Make SAS environment variables mandatory


Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-09-23 12:13:20 +00:00
parent 8cd6f1d3a5
commit c46e71d76e
6 changed files with 90 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ import Image from "@scandic-hotels/design-system/Image"
import Link from "@scandic-hotels/design-system/Link"
import SkeletonShimmer from "@scandic-hotels/design-system/SkeletonShimmer"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { trpc } from "@scandic-hotels/trpc/client"
import useLang from "@/hooks/useLang"
@@ -17,6 +18,14 @@ export function Header() {
const lang = useLang()
const session = useSession()
const {
data: profileData,
isLoading,
isSuccess,
} = trpc.partner.sas.getEuroBonusProfile.useQuery(undefined, {
enabled: session.status === "authenticated",
})
return (
<>
<header className={styles.header}>
@@ -45,6 +54,15 @@ export function Header() {
{session.data?.user && <>{session.data.user.email}</>}
</span>
</Typography>
{isLoading && <SkeletonShimmer width={"6ch"} height={"1ch"} />}
{isSuccess && profileData && (
<Typography variant="Body/Supporting text (caption)/smBold">
<span>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{profileData.points.total} Points
</span>
</Typography>
)}
<Link color={"white"} href={`/${lang}/logout`} prefetch={false}>
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
{"Logout"}