Something went wrong. Try again.
leaflet fork for copy edit / bug fixes forked from leaflet.pub/leaflet
Something went wrong. Try again.
832 B · 19 lines
TypeScript
1234567891011121314151617181920// Managing a subscription (tier changes, cancellation, the email toggle)// requires a real session, which a reader following a link from their inbox// doesn't have: bounce through email-login, which reuses a matching session or// emails a code, then land on the publication with the manage panel// auto-opened. Publications without a resolvable URL fall back to the// account-wide subscriptions page.export function manageSubscriptionUrl(args: { baseUrl: string; email: string; publicationUrl: string | null | undefined;}): string { const target = args.publicationUrl ? `${args.publicationUrl.replace(/\/$/, "")}?manage_subscription=1` : `${args.baseUrl}/subscriptions`; return `${args.baseUrl}/api/auth/email-login?${new URLSearchParams({ email: args.email, redirect: target, }).toString()}`;}