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:
Anton Gunnarsson
2025-03-05 08:17:02 +00:00
parent 81f1470405
commit 43d3713f59
8 changed files with 33 additions and 23 deletions

View File

@@ -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`)
}