From 6f9cde44b5b75b724ae5b4aeefa3c98d69771c21 Mon Sep 17 00:00:00 2001 From: Jake Laderman Date: Mon, 25 Nov 2024 13:22:11 -0600 Subject: [PATCH] add redirect --- app/api/newsletter/route.ts | 3 +-- pages/kubernetes/[...slug].tsx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 pages/kubernetes/[...slug].tsx diff --git a/app/api/newsletter/route.ts b/app/api/newsletter/route.ts index 33fb230c..7c0e4f81 100644 --- a/app/api/newsletter/route.ts +++ b/app/api/newsletter/route.ts @@ -47,8 +47,7 @@ async function setEmail(email) { } if (body?.category === 'CONFLICT') { - const contactId = body.message?.match(/Existing ID:\s*(?\d+)/) - ?.groups?.id + const contactId = body.message?.match(/Existing ID:\s*(\d+)/)?.[1] if (!contactId) { return false diff --git a/pages/kubernetes/[...slug].tsx b/pages/kubernetes/[...slug].tsx new file mode 100644 index 00000000..271ac717 --- /dev/null +++ b/pages/kubernetes/[...slug].tsx @@ -0,0 +1,17 @@ +import { type GetServerSideProps } from 'next' + +export const getServerSideProps: GetServerSideProps = async ({ params }) => { + const slug = params?.slug as string[] + const newPath = `/${slug.join('/')}` + + return { + redirect: { + destination: newPath, + permanent: true, + }, + } +} + +export default function KubernetesRedirect() { + return null +}