Quantcast
Viewing latest article 18
Browse Latest Browse All 1634

How to trigger LayoutServerLoad on every navigation in SvelteKit?

I want to add a JWT verification/refresh in +layout.server.ts that is called on every navigation action.

I've got following code and noticed that the console.log() statement is only ran, when I reload the page with let's say F5 and not when navigating via anchor tags for example.

import type { LayoutServerLoad } from './$types';export const load: LayoutServerLoad = async ({ cookies }) => {    console.log("running layout on server");};

How can I make it that the load function is called every time when navigating?


Viewing latest article 18
Browse Latest Browse All 1634

Trending Articles