Last active
January 23, 2023 17:36
-
-
Save barvian/874cb7d4a4914ce91b16a1f6add41303 to your computer and use it in GitHub Desktop.
Vite plugin for SvelteKit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script context="module" lang="ts"> | |
import type * as $types from './$types' | |
export const csr = false | |
export const getData = (async (event) => { | |
return { | |
server: event.data.server, | |
client: 'client data!' | |
} | |
}) satisfies $types.PageLoad | |
export const getServerData = (async () => { | |
return { | |
server: 'server data!' | |
} | |
}) satisfies $types.PageServerLoad | |
export const serverActions = { | |
default(event) { | |
return { success: true } | |
} | |
} satisfies $types.Actions | |
</script> | |
<script lang="ts"> | |
import Button from '../components/Button.svelte' | |
export let data: $types.PageData | |
</script> | |
<Button /> | |
Some client-side data: {data.client} | |
Some server-side data: {data.server} | |
<form method="POST"> | |
<button type="submit">Submit</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment