This commit is contained in:
Andras Bacsai
2022-12-12 08:44:23 +01:00
parent f55b861849
commit c445fc0f8a
44 changed files with 3130 additions and 53 deletions

9
apps/client/src/app.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}

12
apps/client/src/app.html Normal file
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" />
%sveltekit.head%
</head>
<body>
<div class="h-screen">%sveltekit.body%</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
/* Write your global styles here, in PostCSS syntax */
@tailwind base;
@tailwind components;
@tailwind utilities;
html {
@apply bg-black text-white;
}
input {
@apply bg-black border;
}
button {
@apply border px-2 p-1 bg-green-500;
}

View File

@@ -0,0 +1,22 @@
import { writable, readable, type Writable, type Readable } from 'svelte/store';
import superjson from 'superjson';
import type { AppRouter } from 'server/src/router';
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import { browser, dev } from '$app/environment';
import Cookies from 'js-cookie';
const serverBaseUrl = dev ? `http://${browser && window.location.hostname}:2022` : '';
export let token: string = Cookies.get('token') || '';
export const t = createTRPCProxyClient<AppRouter>({
transformer: superjson,
links: [
httpBatchLink({
url: `${serverBaseUrl}/trpc`,
headers() {
return {
Authorization: token
};
}
})
]
});

View File

@@ -0,0 +1,7 @@
<script lang="ts">
import '../app.postcss';
</script>
<div class="h-full">
<slot />
</div>

View File

@@ -0,0 +1,10 @@
<script lang="ts">
import { t } from '$lib/store';
import { onMount } from 'svelte';
onMount(async () => {
const a = await t.api.getConnection.query();
console.log(a);
});
</script>
<div>hello</div>