Skip to content

Commit

Permalink
Merge pull request #2108 from zetkin/undocumented/env-var-redirects
Browse files Browse the repository at this point in the history
Env var redirects
  • Loading branch information
richardolsson authored Aug 23, 2024
2 parents f6418e1 + a80a9bc commit 13a6320
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 20 deletions.
20 changes: 0 additions & 20 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ module.exports = {
permanent: false,
},
// redirects to Gen2 for MVP August 2021
{
source: '/organize/:orgId/people/:personId/edit',
destination: `http://organize.${process.env.ZETKIN_API_DOMAIN}/people/person%3A:personId/?org=:orgId`,
permanent: false,
},
{
source: '/organize/:orgId(\\d{1,})',
destination: '/legacy?orgId=:orgId',
Expand All @@ -60,21 +55,6 @@ module.exports = {
destination: '/legacy?path=/campaign/action%3A:eventId&orgId=:orgId',
permanent: false,
},
{
source: '/o/:orgId',
destination: `http://${process.env.ZETKIN_API_DOMAIN}/o/:orgId`,
permanent: false,
},
{
source: '/o/:orgId/events/:eventId',
destination: `http://${process.env.ZETKIN_API_DOMAIN}/o/:orgId`,
permanent: false,
},
{
source: '/o/:orgId/projects/:campId',
destination: `http://${process.env.ZETKIN_API_DOMAIN}/o/:orgId/campaigns/:campId`,
permanent: false,
},
{
source: '/organize/:orgId/campaigns/:path*',
destination: '/organize/:orgId/projects/:path*',
Expand Down
5 changes: 5 additions & 0 deletions src/app/o/[orgId]/events/[eventId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { redirect } from 'next/navigation';

export default function Page({ params }: { params: { orgId: string } }) {
redirect(`http://${process.env.ZETKIN_API_DOMAIN}/o/${params.orgId}`);
}
5 changes: 5 additions & 0 deletions src/app/o/[orgId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { redirect } from 'next/navigation';

export default function Page({ params }: { params: { orgId: string } }) {
redirect(`http://${process.env.ZETKIN_API_DOMAIN}/o/${params.orgId}`);
}
12 changes: 12 additions & 0 deletions src/app/o/[orgId]/projects/[projId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { redirect } from 'next/navigation';

export default function Page({
params,
}: {
params: { orgId: string; projId: string };
}) {
const { orgId, projId } = params;
redirect(
`http://${process.env.ZETKIN_API_DOMAIN}/o/${orgId}/campaigns/${projId}`
);
}
12 changes: 12 additions & 0 deletions src/app/o/[orgId]/surveys/[surveyId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { redirect } from 'next/navigation';

export default function Page({
params,
}: {
params: { orgId: string; surveyId: string };
}) {
const { orgId, surveyId } = params;
redirect(
`http://${process.env.ZETKIN_API_DOMAIN}/o/${orgId}/surveys/${surveyId}`
);
}

0 comments on commit 13a6320

Please sign in to comment.