URLs con barra final (trailingSlash) como el sitio original
next.config: trailingSlash true → /es redirige a /es/ y los enlaces se generan con barra. Se ajustan a barra final los destinos internos que se enlazan a mano (logout /log-out/ y su redirect, y los window.location.assign de login/ select-account) para evitar el salto 308 extra. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,5 +18,5 @@ export async function GET(_request: Request, { params }: { params: Promise<{ loc
|
||||
const session = await getSession()
|
||||
session.destroy()
|
||||
|
||||
return new NextResponse(null, { status: 303, headers: { Location: `/${loc}` } })
|
||||
return new NextResponse(null, { status: 303, headers: { Location: `/${loc}/` } })
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export function LoginForm() {
|
||||
// Navegación completa (no del lado cliente): fuerza que el servidor
|
||||
// re-renderice el layout/cabecera con la sesión nueva. Con router.push
|
||||
// el layout persiste y la cabecera seguía mostrando "Conectar".
|
||||
window.location.assign(`/${locale}${data.needsSelection ? '/select-account' : '/my-account'}`)
|
||||
window.location.assign(`/${locale}${data.needsSelection ? '/select-account/' : '/my-account/'}`)
|
||||
return
|
||||
} else {
|
||||
const key = (ERROR_KEYS as readonly string[]).includes(data.error ?? '') ? data.error! : 'genericError'
|
||||
|
||||
@@ -28,7 +28,7 @@ export function SelectAccountForm({ accounts }: { accounts: GameAccount[] }) {
|
||||
})
|
||||
const data: { success?: boolean } = await res.json()
|
||||
// Navegación completa: re-renderiza el layout/cabecera con la cuenta ya elegida.
|
||||
if (data.success) window.location.assign(`/${locale}/my-account`)
|
||||
if (data.success) window.location.assign(`/${locale}/my-account/`)
|
||||
else {
|
||||
setError(t('error'))
|
||||
setBusy(null)
|
||||
|
||||
@@ -118,7 +118,7 @@ export function SiteHeader({
|
||||
<Link href="/my-account">MI CUENTA</Link>
|
||||
</p>
|
||||
<p>
|
||||
<a href={`/${locale}/log-out`}>DESCONECTAR</a>
|
||||
<a href={`/${locale}/log-out/`}>DESCONECTAR</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,8 @@ import createNextIntlPlugin from 'next-intl/plugin'
|
||||
const withNextIntl = createNextIntlPlugin('./i18n/request.ts')
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
// URLs con barra final (/es/ en vez de /es), como el sitio original.
|
||||
trailingSlash: true,
|
||||
}
|
||||
|
||||
export default withNextIntl(nextConfig)
|
||||
|
||||
Reference in New Issue
Block a user