Merged in feat/SW-1810-prevent-starting-link-flow-when-linked (pull request #1469)
Prevent SAS link flow when already linked * Implement check for checking sas_eb membership when starting link flow Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -3,6 +3,8 @@ import React from "react"
|
||||
|
||||
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import { getEurobonusMembership } from "@/utils/user"
|
||||
|
||||
import { SASModal } from "../components/SASModal"
|
||||
import { LinkAccountForm } from "./LinkAccountForm"
|
||||
|
||||
@@ -13,10 +15,11 @@ export default async function SASxScandicLinkPage({
|
||||
}: PageArgs<LangParams>) {
|
||||
const profile = await getProfileSafely()
|
||||
|
||||
// TODO check if already linked
|
||||
const alreadyLinked = false
|
||||
if (!profile) return null
|
||||
|
||||
if (alreadyLinked) {
|
||||
const eurobonusMembership = getEurobonusMembership(profile.memberships)
|
||||
|
||||
if (eurobonusMembership) {
|
||||
redirect(`/${params.lang}/sas-x-scandic/error?errorCode=alreadyLinked`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user