diff --git a/src/lib/api/notes.js b/src/lib/api/notes.js index 0b4b24326..c3c87152a 100644 --- a/src/lib/api/notes.js +++ b/src/lib/api/notes.js @@ -37,7 +37,7 @@ export async function list(doc_id, fetch) { * @param {globalThis.fetch} fetch * @returns {Promise} */ -export async function get(doc_id, note_id, fetch) { +export async function get(doc_id, note_id, fetch = globalThis.fetch) { const endpoint = new URL( `documents/${doc_id}/notes/${note_id}.json`, BASE_API_URL, diff --git a/src/lib/components/forms/tests/DocumentUpload.test.ts b/src/lib/components/forms/tests/DocumentUpload.test.ts index d92a9c535..d1fba0209 100644 --- a/src/lib/components/forms/tests/DocumentUpload.test.ts +++ b/src/lib/components/forms/tests/DocumentUpload.test.ts @@ -23,7 +23,7 @@ describe("DocumentUpload form", () => { }); await act(() => fireEvent(dropElement, dropEvent)); const fileListItem = screen.getByRole("listitem"); - expect(fileListItem).toContainHTML("128 kB"); + expect(fileListItem).toContain("128 kB"); }); it("provides feedback when a file is too large", async () => { render(DocumentUploadForm); @@ -39,6 +39,6 @@ describe("DocumentUpload form", () => { }); await act(() => fireEvent(dropElement, dropEvent)); const fileListItem = screen.getByRole("listitem"); - expect(fileListItem).toContainHTML("The maximum size for a PDF is 500MB"); + expect(fileListItem).toContain("The maximum size for a PDF is 500MB"); }); }); diff --git a/src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.js b/src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.ts similarity index 77% rename from src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.js rename to src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.ts index a9de0b125..a40fdb573 100644 --- a/src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.js +++ b/src/routes/(embed)/documents/[id]/annotations/[note_id]/+page.ts @@ -5,8 +5,8 @@ import * as notesApi from "$lib/api/notes.js"; /** @type {import('./$types').PageLoad} */ export async function load({ params, url, fetch }) { const [document, note] = await Promise.all([ - documents.get(params.id, fetch), - notesApi.get(params.id, params.note_id), + documents.get(+params.id, fetch), + notesApi.get(+params.id, params.note_id, fetch), ]); return { diff --git a/src/routes/(embed)/documents/[id]/pages/[page]/+page.js b/src/routes/(embed)/documents/[id]/pages/[page]/+page.ts similarity index 79% rename from src/routes/(embed)/documents/[id]/pages/[page]/+page.js rename to src/routes/(embed)/documents/[id]/pages/[page]/+page.ts index a8d04399b..44adc1917 100644 --- a/src/routes/(embed)/documents/[id]/pages/[page]/+page.js +++ b/src/routes/(embed)/documents/[id]/pages/[page]/+page.ts @@ -4,10 +4,10 @@ import * as notesApi from "$lib/api/notes.js"; /** @type {import('./$types').PageLoad} */ export async function load({ params, fetch }) { - const { page } = params; + const page = +params.page; let [document, notes] = await Promise.all([ - documents.get(params.id, fetch), - notesApi.list(params.id, fetch), + documents.get(+params.id, fetch), + notesApi.list(+params.id, fetch), ]); return { diff --git a/src/routes/(embed)/projects/[project_id]/+page.js b/src/routes/(embed)/projects/[project_id]/+page.ts similarity index 74% rename from src/routes/(embed)/projects/[project_id]/+page.js rename to src/routes/(embed)/projects/[project_id]/+page.ts index 3b57f6277..ce79d3155 100644 --- a/src/routes/(embed)/projects/[project_id]/+page.js +++ b/src/routes/(embed)/projects/[project_id]/+page.ts @@ -5,8 +5,8 @@ import * as projects from "$lib/api/projects.js"; /** @type {import('./$types').PageLoad} */ export async function load({ params, fetch }) { const [project, documents] = await Promise.all([ - projects.get(params.project_id, fetch), - projects.documents(params.project_id, fetch), + projects.get(+params.project_id, fetch), + projects.documents(+params.project_id, fetch), ]); return {