add sveltekit template
This commit is contained in:
parent
401e268281
commit
14f8e77e6a
24 changed files with 2157 additions and 1 deletions
16
Foxnouns.Frontend/src/app.d.ts
vendored
Normal file
16
Foxnouns.Frontend/src/app.d.ts
vendored
Normal 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 {};
|
12
Foxnouns.Frontend/src/app.html
Normal file
12
Foxnouns.Frontend/src/app.html
Normal 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>
|
15
Foxnouns.Frontend/src/hooks.server.ts
Normal file
15
Foxnouns.Frontend/src/hooks.server.ts
Normal 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);
|
||||
}
|
1
Foxnouns.Frontend/src/lib/index.ts
Normal file
1
Foxnouns.Frontend/src/lib/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
// place files you want to import through the `$lib` alias in this folder.
|
2
Foxnouns.Frontend/src/routes/+page.svelte
Normal file
2
Foxnouns.Frontend/src/routes/+page.svelte
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue