add sveltekit template

This commit is contained in:
sam 2024-06-08 21:02:12 +02:00
parent 401e268281
commit 14f8e77e6a
24 changed files with 2157 additions and 1 deletions

16
Foxnouns.Frontend/src/app.d.ts vendored Normal file
View file

@ -0,0 +1,16 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
interface Locals {
token?: string;
}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};

View file

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>

View file

@ -0,0 +1,15 @@
import { PRIVATE_API_BASE } from "$env/static/private";
import { PUBLIC_API_BASE } from "$env/static/public";
export async function handle({ event, resolve }) {
event.locals.token = event.cookies.get("pronounscc-token");
return await resolve(event);
}
export function handleFetch({ event, request, fetch }) {
if (request.url.startsWith(PUBLIC_API_BASE))
request = new Request(request.url.replace(PUBLIC_API_BASE, PRIVATE_API_BASE), request);
if (event.locals.token) request.headers.set("Authorization", event.locals.token);
return fetch(request);
}

View file

@ -0,0 +1 @@
// place files you want to import through the `$lib` alias in this folder.

View file

@ -0,0 +1,2 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>