diff --git a/website/src/services/lapisApi.ts b/website/src/services/lapisApi.ts index 4a5c0c06c..36f1472bc 100644 --- a/website/src/services/lapisApi.ts +++ b/website/src/services/lapisApi.ts @@ -10,9 +10,13 @@ import { mutationsResponse, } from '../types/lapis.ts'; +function withSample(path: Path) { + return `/sample${path}` as const; +} + const detailsEndpoint = makeEndpoint({ method: 'post', - path: '/details', + path: withSample('/details'), alias: 'details', parameters: [ { @@ -26,7 +30,7 @@ const detailsEndpoint = makeEndpoint({ const aggregatedEndpoint = makeEndpoint({ method: 'post', - path: '/aggregated', + path: withSample('/aggregated'), alias: 'aggregated', parameters: [ { @@ -40,7 +44,7 @@ const aggregatedEndpoint = makeEndpoint({ const nucleotideMutationsEndpoint = makeEndpoint({ method: 'post', - path: '/nucleotideMutations', + path: withSample('/nucleotideMutations'), alias: 'nucleotideMutations', parameters: [ { @@ -54,7 +58,7 @@ const nucleotideMutationsEndpoint = makeEndpoint({ const aminoAcidMutationsEndpoint = makeEndpoint({ method: 'post', - path: '/aminoAcidMutations', + path: withSample('/aminoAcidMutations'), alias: 'aminoAcidMutations', parameters: [ { @@ -68,7 +72,7 @@ const aminoAcidMutationsEndpoint = makeEndpoint({ const nucleotideInsertionsEndpoint = makeEndpoint({ method: 'post', - path: '/nucleotideInsertions', + path: withSample('/nucleotideInsertions'), alias: 'nucleotideInsertions', parameters: [ { @@ -82,7 +86,7 @@ const nucleotideInsertionsEndpoint = makeEndpoint({ const aminoAcidInsertionsEndpoint = makeEndpoint({ method: 'post', - path: '/aminoAcidInsertions', + path: withSample('/aminoAcidInsertions'), alias: 'aminoAcidInsertions', parameters: [ { @@ -96,7 +100,7 @@ const aminoAcidInsertionsEndpoint = makeEndpoint({ const alignedNucleotideSequencesEndpoint = makeEndpoint({ method: 'post', - path: '/alignedNucleotideSequences', + path: withSample('/alignedNucleotideSequences'), alias: 'alignedNucleotideSequences', immutable: true, parameters: [ @@ -111,7 +115,7 @@ const alignedNucleotideSequencesEndpoint = makeEndpoint({ const unalignedNucleotideSequencesEndpoint = makeEndpoint({ method: 'post', - path: '/unalignedNucleotideSequences', + path: withSample('/unalignedNucleotideSequences'), alias: 'unalignedNucleotideSequences', immutable: true, parameters: [ @@ -126,7 +130,7 @@ const unalignedNucleotideSequencesEndpoint = makeEndpoint({ const alignedAminoAcidSequencesEndpoint = makeEndpoint({ method: 'post', - path: '/alignedAminoAcidSequences/:gene', + path: withSample('/alignedAminoAcidSequences/:gene'), alias: 'alignedAminoAcidSequences', immutable: true, parameters: [ diff --git a/website/vitest.setup.ts b/website/vitest.setup.ts index e93ccb3cb..940dbb90f 100755 --- a/website/vitest.setup.ts +++ b/website/vitest.setup.ts @@ -49,7 +49,7 @@ const backendRequestMocks = { const lapisRequestMocks = { details: (statusCode: number = 200, response: DetailsResponse | LapisError) => { testServer.use( - http.post(`${testConfig.serverSide.lapisUrls.dummy}/details`, () => { + http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/details`, () => { return new Response(JSON.stringify(response), { status: statusCode, }); @@ -58,7 +58,7 @@ const lapisRequestMocks = { }, nucleotideMutations: (statusCode: number = 200, response: MutationsResponse | LapisError) => { testServer.use( - http.post(`${testConfig.serverSide.lapisUrls.dummy}/nucleotideMutations`, () => { + http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/nucleotideMutations`, () => { return new Response(JSON.stringify(response), { status: statusCode, }); @@ -67,7 +67,7 @@ const lapisRequestMocks = { }, aminoAcidMutations: (statusCode: number = 200, response: MutationsResponse | LapisError) => { testServer.use( - http.post(`${testConfig.serverSide.lapisUrls.dummy}/aminoAcidMutations`, () => { + http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/aminoAcidMutations`, () => { return new Response(JSON.stringify(response), { status: statusCode, }); @@ -76,7 +76,7 @@ const lapisRequestMocks = { }, nucleotideInsertions: (statusCode: number = 200, response: InsertionsResponse | LapisError) => { testServer.use( - http.post(`${testConfig.serverSide.lapisUrls.dummy}/nucleotideInsertions`, () => { + http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/nucleotideInsertions`, () => { return new Response(JSON.stringify(response), { status: statusCode, }); @@ -85,7 +85,7 @@ const lapisRequestMocks = { }, aminoAcidInsertions: (statusCode: number = 200, response: InsertionsResponse | LapisError) => { testServer.use( - http.post(`${testConfig.serverSide.lapisUrls.dummy}/aminoAcidInsertions`, () => { + http.post(`${testConfig.serverSide.lapisUrls.dummy}/sample/aminoAcidInsertions`, () => { return new Response(JSON.stringify(response), { status: statusCode, });