|
1 | | -import {error} from "@sveltejs/kit"; |
2 | | -import type {PageLoad} from "./$types"; |
3 | | -import {marked} from "marked"; |
4 | | -import {PUBLIC_API_URL, PUBLIC_BUCKET_URL} from "$env/static/public"; |
5 | | -import type {paths} from "$lib/client"; |
| 1 | +import { error } from "@sveltejs/kit"; |
| 2 | +import type { PageLoad } from "./$types"; |
| 3 | +import { marked } from "marked"; |
| 4 | +import { PUBLIC_API_URL, PUBLIC_BUCKET_URL } from "$env/static/public"; |
| 5 | +import type { paths } from "$lib/client"; |
6 | 6 | import createClient from "openapi-fetch"; |
7 | 7 |
|
8 | | -export const load: PageLoad = async ({params, fetch}) => { |
9 | | - const client = createClient<paths>({baseUrl: PUBLIC_API_URL, fetch: fetch}); |
| 8 | +export const load: PageLoad = async ({ params, fetch }) => { |
| 9 | + const client = createClient<paths>({ baseUrl: PUBLIC_API_URL, fetch: fetch }); |
10 | 10 |
|
11 | | - const {data: project, response} = await client.GET("/projects/{id}", { |
12 | | - params: {path: {id: params.id}}, |
13 | | - }); |
| 11 | + const { data: project, response } = await client.GET("/projects/{id}", { |
| 12 | + params: { path: { id: params.id } }, |
| 13 | + }); |
14 | 14 |
|
15 | | - if (!project) { |
16 | | - error(response.status, await response.text()); |
17 | | - } |
| 15 | + if (!project) { |
| 16 | + error(response.status, await response.text()); |
| 17 | + } |
18 | 18 |
|
19 | | - const content = await fetch(`${PUBLIC_BUCKET_URL}/content/${project.id}.md`) |
20 | | - .then((response) => response.text()) |
21 | | - .then((md) => marked.parse(md)); |
| 19 | + const content = await fetch(`${PUBLIC_BUCKET_URL}/content/${project.id}.md`) |
| 20 | + .then((response) => response.text()) |
| 21 | + .then((md) => marked.parse(md)); |
22 | 22 |
|
23 | | - return {project, content}; |
| 23 | + return { project, content }; |
24 | 24 | }; |
0 commit comments