20e1d5a6b5
Mueve la página de login a /log-in y actualiza todas las referencias (enlace CONECTAR del header y los redirect de auth de ~45 páginas). /login ahora da 404. La API /api/auth/login no se toca (solo la ruta de página). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import type { Metadata } from 'next'
|
|
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { redirect } from '@/i18n/navigation'
|
|
import { getSession } from '@/lib/session'
|
|
import { getRealmName } from '@/lib/realm'
|
|
import { reconcileSumUpCheckouts } from '@/lib/sumup'
|
|
import { PageShell } from '@/components/PageShell'
|
|
import { DPointsTabs } from '@/components/DPointsTabs'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
|
|
const { locale } = await params
|
|
const t = await getTranslations({ locale, namespace: 'Points' })
|
|
return { title: t('dpoints.title') }
|
|
}
|
|
|
|
export default async function DPointsPage({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params
|
|
setRequestLocale(locale)
|
|
const t = await getTranslations('Points')
|
|
|
|
const session = await getSession()
|
|
if (!session.bnetId) redirect({ href: '/log-in', locale })
|
|
if (!session.username) redirect({ href: '/select-account', locale })
|
|
|
|
// SumUp no tiene webhooks: reconciliamos aquí los pagos SumUp pendientes de
|
|
// esta cuenta por si el navegador no volvió al return_url tras pagar.
|
|
if (session.accountId) await reconcileSumUpCheckouts({ accountId: session.accountId }).catch(() => {})
|
|
|
|
const realm = await getRealmName()
|
|
const currency = (process.env.DP_CURRENCY || 'eur').toLowerCase()
|
|
|
|
return (
|
|
<PageShell title={t('dpoints.title')}>
|
|
<DPointsTabs realm={realm} currency={currency} />
|
|
</PageShell>
|
|
)
|
|
}
|