Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 764 Bytes

svelte.md

File metadata and controls

17 lines (9 loc) · 764 Bytes

Svelte

Initialization

In your Svelte application, create a src/auth.ts file that allows to make authenticated requests to the backend like this:

<<< @/examples/frontend/svelte/src/auth.ts

This file exports an authFetch function that can be used just like the normal fetch API and will redirect to the login page if the user needs to log in.

Usage

A Svelte component using the Auth client and loading the message from one of the platform example servers looks like this:

<<< @/examples/frontend/svelte/src/App.svelte

You can find the full Vite + Svelte example application here.