Web UI setup

This commit is contained in:
nemunaire 2025-10-17 17:18:37 +07:00
commit 682ca6bb20
19 changed files with 6026 additions and 2 deletions

13
web/src/app.d.ts vendored Normal file
View file

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

11
web/src/app.html Normal file
View file

@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<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>

30
web/src/lib/hey-api.ts Normal file
View file

@ -0,0 +1,30 @@
import type { CreateClientConfig } from "./api/client.gen";
export class NotAuthorizedError extends Error {
constructor(message: string) {
super(message);
this.name = "NotAuthorizedError";
}
}
async function customFetch(url: string, init: RequestInit): Promise<Response> {
const response = await fetch(url, init);
if (response.status === 400) {
const json = await response.json();
if (
json.error ==
"error in openapi3filter.SecurityRequirementsError: security requirements failed: invalid session"
) {
throw new NotAuthorizedError(json.error.substring(80));
}
}
return response;
}
export const createClientConfig: CreateClientConfig = (config) => ({
...config,
baseUrl: "/api/",
fetch: customFetch,
});

1
web/src/lib/index.ts Normal file
View file

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