Skip to content

Commit

Permalink
fix: add bills, politicians, and votings dynamic page entries to avoi…
Browse files Browse the repository at this point in the history
…d 404
  • Loading branch information
Th1nkK1D committed Jun 14, 2024
1 parent 4990d09 commit e46bcc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/routes/bills/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import type { Bill } from '$models/bill';
import { BillEventType, type BillEvent } from '$models/bill-event';
import { DefaultVoteOption, DefaultVotingResult } from '$models/voting';

export async function entries() {
return (await fetchBills()).map(({ id }) => ({ id }));
}

const expectedEventOrder = Object.values(BillEventType).reverse();

export async function load({ params }) {
Expand Down
4 changes: 4 additions & 0 deletions src/routes/politicians/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface VotingAbsentStats {
averageAbsentVoting: number;
}

export async function entries() {
return (await fetchPoliticians()).map(({ id }) => ({ id }));
}

export async function load({ params }) {
const politician = await fetchFromIdOr404(fetchPoliticians, params.id);

Expand Down
4 changes: 4 additions & 0 deletions src/routes/votings/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { createSeo } from '$lib/seo.js';
import type { Bill } from '$models/bill';
import type { ResultsByAffiliation } from './+page.js';

export async function entries() {
return (await fetchVotings()).map(({ id }) => ({ id }));
}

export async function load({ params }) {
const voting = await fetchFromIdOr404(fetchVotings, params.id);
const votes = (await fetchVotes()).filter(({ votingId }) => votingId === voting.id);
Expand Down

0 comments on commit e46bcc5

Please sign in to comment.