Skip to content
Snippets Groups Projects
Commit babae150 authored by David Smadja's avatar David Smadja
Browse files

Rename bill to pjl

parent f876d902
Branches
No related tags found
No related merge requests found
......@@ -4,9 +4,9 @@ import fs from "fs/promises"
import path from "path"
export const GET: RequestHandler = async ({ params, url }) => {
const { bill } = params as { bill: string }
const { pjl } = params as { pjl: string }
const filePath = path.resolve(`static/${bill}.html`)
const filePath = path.resolve(`static/${pjl}.html`)
try {
const html = await fs.readFile(filePath, "utf-8")
......@@ -26,7 +26,7 @@ export const GET: RequestHandler = async ({ params, url }) => {
/<a href="https:\/\/git\.tricoteuses\.fr.+\/([^/]+\.md)">([^<]+)<\/a>/g,
(match, p1, p2) => {
const lawArticle = p1.replace(".md", "")
return `<a href='${url.origin}/bill/${bill}?lawArticle=${lawArticle}'>${p2}</a>`
return `<a href='${url.origin}/pjl/${pjl}?lawArticle=${lawArticle}'>${p2}</a>`
},
)
return new Response(htmlWithLinks, {
......
......@@ -4,10 +4,10 @@ export const load: PageLoad = async ({
fetch,
params,
}): Promise<{ billHTML: string | undefined }> => {
const bill = params.bill
const pjl = params.pjl
if (bill !== undefined) {
const res = await fetch(`/api/bill/${bill}`, {
if (pjl !== undefined) {
const res = await fetch(`/api/pjl/${pjl}`, {
headers: {
Accept: "text/html",
"Content-Type": "text/html; charset=utf-8",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment