Is it possible to use +layout.server.ts and +layout.ts at the same time? #6758
-
Hi, I have a Am I right, that this is not possible. At least it doesn't work for me. I cannot acces the data which is returned from +layout.server.ts
+layout.ts
Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi Christian, It is indeed possible to use both - export const load: LayoutLoad = async ({ parent }: LayoutLoadEvent) => {
- const { locale } = await parent();
+ export const load: LayoutLoad = async ({ data }: LayoutLoadEvent) => {
+ const { locale } = data;
await loadLocaleAsync(locale);
return {};
}; |
Beta Was this translation helpful? Give feedback.
Hi Christian,
It is indeed possible to use both
+layout.server
and+layout
. Thedata
returned from the first gets passed to the second.https://kit.svelte.dev/docs/load#input-properties-data