diff --git a/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.svelte b/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.svelte index e131b7644..fd6ee9ff5 100644 --- a/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.svelte +++ b/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.svelte @@ -2,15 +2,23 @@ import 'viewer/component'; import {type LexboxServiceProvider} from 'viewer/service-provider'; import {LfClassicLexboxApi} from './lfClassicLexboxApi'; + import type {PageData} from './$types'; + export let data: PageData; - setLexboxApiProvider(); - // onMount(() => { - // }); - - function setLexboxApiProvider() { - const serviceProvider: LexboxServiceProvider = window.lexbox.ServiceProvider; - serviceProvider.setService('LexboxApi', new LfClassicLexboxApi('sena-3')); + const serviceProvider: LexboxServiceProvider = window.lexbox.ServiceProvider; + let service: LfClassicLexboxApi; + $: { + if (serviceProvider) { + let localService = new LfClassicLexboxApi(data.code); + serviceProvider.setService('LexboxApi', localService); + service = localService; + } } + - +{#if service} + {#key service} + + {/key} +{/if} diff --git a/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.ts b/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.ts index cd328576c..617aeb10a 100644 --- a/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.ts +++ b/frontend/src/routes/(authenticated)/project/[project_code]/viewer/+page.ts @@ -1 +1,5 @@ -export const ssr = false; // 💖 +import type {PageLoadEvent} from './$types'; +export const ssr = false; // 💖 +export function load(event: PageLoadEvent) { + return {code: event.params.project_code}; +}