Merged in feat/3614-basicInfo (pull request #3427)
feat(SW-3614): use new loyalty prop in basicProfile * feat(SW-3614): use new loyalty prop in basicProfile * PR fixes Approved-by: Matilda Landström
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { redirect } from "next/navigation"
|
||||
import React from "react"
|
||||
|
||||
import { getEurobonusMembership } from "@scandic-hotels/trpc/routers/user/helpers"
|
||||
import { scandicMembershipTypes } from "@scandic-hotels/trpc/routers/user/helpers"
|
||||
|
||||
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||
import { getBasicProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { SASModal } from "../components/SASModal"
|
||||
import { LinkAccountForm } from "./LinkAccountForm"
|
||||
@@ -12,11 +12,13 @@ export default async function SASxScandicLinkPage(
|
||||
props: PageProps<"/[lang]/sas-x-scandic/link">
|
||||
) {
|
||||
const params = await props.params
|
||||
const profile = await getProfileSafely()
|
||||
const profile = await getBasicProfileSafely()
|
||||
|
||||
if (!profile || !profile.loyalty) return null
|
||||
|
||||
const eurobonusMembership = getEurobonusMembership(profile.loyalty)
|
||||
const eurobonusMembership = profile.loyalty.memberships?.some(
|
||||
(m) => m.membershipType === scandicMembershipTypes.SAS_EB
|
||||
)
|
||||
|
||||
if (eurobonusMembership) {
|
||||
redirect(`/${params.lang}/sas-x-scandic/error?errorCode=alreadyLinked`)
|
||||
|
||||
Reference in New Issue
Block a user