Update useChecklists function to load local file instead of remote URL

This commit is contained in:
Tgrl84250 2024-06-11 10:39:21 +02:00
parent 6730746b0d
commit 4458313b19

View file

@ -7,9 +7,9 @@ import Footer from "~/components/furniture/footer";
import { ChecklistContext } from "~/store/checklist-context";
import type { Sections } from "~/types/PSC";
export const useChecklists = routeLoader$(async () => {
const remoteUrl = 'https://raw.githubusercontent.com/Lissy93/personal-security-checklist/HEAD/personal-security-checklist.yml';
return fetch(remoteUrl)
export const useChecklists = routeLoader$(async ({ request }) => {
const localUrl = '/personal-security-checklist.yml';
return fetch(new URL(localUrl, request.url).toString())
.then((res) => res.text())
.then((res) => jsyaml.load(res) as Sections)
.catch(() => []);