Merged in fix/LOY-380-fix-promo-login-redirect (pull request #2887)
fix(LOY-380): Redirect back to promo page after login * fix(LOY-380): Fix redirect back to promo page after login Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"use client"
|
||||
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { login } from "@scandic-hotels/common/constants/routes/handleAuth"
|
||||
import { useLazyPathname } from "@scandic-hotels/common/hooks/useLazyPathname"
|
||||
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
||||
|
||||
import useLang from "@/hooks/useLang"
|
||||
|
||||
export default function PromoLoginButton() {
|
||||
const lang = useLang()
|
||||
const intl = useIntl()
|
||||
const pathname = useLazyPathname()
|
||||
const loginHref = pathname
|
||||
? `${login[lang]}?redirectTo=${encodeURIComponent(pathname)}`
|
||||
: login[lang]
|
||||
|
||||
return (
|
||||
<ButtonLink
|
||||
href={loginHref}
|
||||
variant="Primary"
|
||||
color="Inverted"
|
||||
size="Medium"
|
||||
>
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "Log in",
|
||||
})}
|
||||
</ButtonLink>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { cx } from "class-variance-authority"
|
||||
|
||||
import { login } from "@scandic-hotels/common/constants/routes/handleAuth"
|
||||
import { signup } from "@scandic-hotels/common/constants/routes/signup"
|
||||
import ButtonLink from "@scandic-hotels/design-system/ButtonLink"
|
||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||
@@ -15,6 +14,7 @@ import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import ActivateOfferButton from "./ActivateOfferButton"
|
||||
import IneligibleMessage from "./IneligibleMessage"
|
||||
import PromoLoginButton from "./PromoLoginButton"
|
||||
import { isUserEligibleForPromo } from "./utils"
|
||||
|
||||
import styles from "./hero.module.css"
|
||||
@@ -110,16 +110,7 @@ export default async function PromoCampaignHero({
|
||||
})}
|
||||
</p>
|
||||
</Typography>
|
||||
<ButtonLink
|
||||
href={login[lang]}
|
||||
variant="Primary"
|
||||
color="Inverted"
|
||||
size="Medium"
|
||||
>
|
||||
{intl.formatMessage({
|
||||
defaultMessage: "Log in",
|
||||
})}
|
||||
</ButtonLink>
|
||||
<PromoLoginButton />
|
||||
<div className={styles.orSection}>
|
||||
<Divider color="white" />
|
||||
<Typography
|
||||
|
||||
Reference in New Issue
Block a user