Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Preload session argument is undefined on page load #961

@gigatoride

Description

@gigatoride

The following code doesn't work properly on page load:

<script context="module">
	export async function preload(page, session) {
                console.log(session) // undefined on page load!
		const res = await this.fetch(`private/needsession`); // user session needed for this get request
		const article = await res.json();
		return { article };
	}
</script>

Sapper version: 0.27.9

I'm trying to make a get request by the user session using preload

Another example with realworld same issue occurs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions