Skip to content

Commit 27deeba

Browse files
committed
Fix error on page refresh
1 parent 1f1866d commit 27deeba

File tree

7 files changed

+8
-133
lines changed

7 files changed

+8
-133
lines changed

frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
/.svelte-kit
3+
/src/lib/client.ts

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.1",
55
"type": "module",
66
"scripts": {
7-
"gen": "openapi-typescript openapi.json -o src/lib/client.ts --root-types --root-types-no-schema-prefix",
7+
"prepare": "openapi-typescript openapi.json -o src/lib/client.ts --root-types --root-types-no-schema-prefix",
88
"dev": "vite dev",
99
"build": "vite build",
1010
"preview": "vite preview",

frontend/src/lib/client.ts

Lines changed: 0 additions & 129 deletions
This file was deleted.

frontend/src/routes/projects/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const load: PageLoad = async ({ fetch }) => {
1010
.then((response) => response.text())
1111
.then((md) => marked.parse(md));
1212

13-
const client = createClient<paths>({ baseUrl: PUBLIC_API_URL, fetch: fetch });
13+
// FIXME: use svelte's fetch when openapi-fetch fixes it
14+
const client = createClient<paths>({ baseUrl: PUBLIC_API_URL });
1415

1516
const { data: projects, response } = await client.GET("/projects");
1617

frontend/src/routes/projects/[id]/+page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import type { paths } from "$lib/client";
66
import createClient from "openapi-fetch";
77

88
export const load: PageLoad = async ({ params, fetch }) => {
9-
const client = createClient<paths>({ baseUrl: PUBLIC_API_URL, fetch: fetch });
9+
// FIXME: use svelte's fetch when openapi-fetch fixes it
10+
const client = createClient<paths>({ baseUrl: PUBLIC_API_URL });
1011

1112
const { data: project, response } = await client.GET("/projects/{id}", {
1213
params: { path: { id: params.id } },

frontend/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"skipLibCheck": true,
1111
"sourceMap": true,
1212
"strict": true,
13+
"module": "ESNext",
1314
"moduleResolution": "bundler"
1415
}
1516
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ up:
55
down:
66
docker compose down -v
77
gen:
8-
cd backend && DATABASE_URL=sqlite://../sqlite.db cargo sqlx prepare && cd ../frontend && deno i --allow-scripts && deno task gen
8+
cd backend && DATABASE_URL=sqlite://../sqlite.db cargo sqlx prepare && cd ../frontend && deno i --allow-scripts && deno task prepare
99
dev:
1010
cd frontend && deno task dev
1111
fmt:

0 commit comments

Comments
 (0)