Skip to content

Commit

Permalink
Fix some navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ackuq committed Sep 30, 2023
1 parent 2381e44 commit 80c1dd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions apps/web/app/parti/[party]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ import { getParty } from "@lib/api/party/get-party";

interface PageProps {
params: {
party: Party;
party: Lowercase<Party>;
};
}

export async function generateMetadata({ params: { party } }: PageProps) {
export async function generateMetadata({
params: { party: partyAbbreviation },
}: PageProps) {
const party = partyAbbreviation.toUpperCase() as Party;

if (!Object.values(Party).includes(party)) {
return { title: ERROR_404_TITLE };
}
Expand All @@ -32,8 +36,10 @@ export async function generateMetadata({ params: { party } }: PageProps) {
}

export default async function PartyPage({
params: { party: partyAbbreviation },
params: { party: partyAbbreviationLowercase },
}: PageProps) {
const partyAbbreviation =
partyAbbreviationLowercase.toLocaleUpperCase() as Party;
if (!Object.values(Party).includes(partyAbbreviation)) {
return notFound();
}
Expand Down Expand Up @@ -108,6 +114,6 @@ export async function generateStaticParams() {
const parties = Object.values(Party);

return parties.map((party) => ({
party,
party: party.toLocaleLowerCase(),
}));
}
2 changes: 1 addition & 1 deletion apps/web/lib/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const routes = {
return `/standpunkter/${id}`;
},
party(party: Party) {
return `/parti/${party}`;
return `/parti/${party.toLocaleLowerCase()}`;
},
members: "/ledamot",
member(id: string) {
Expand Down

0 comments on commit 80c1dd2

Please sign in to comment.