fix: tests

This commit is contained in:
Bereket Engida
2024-09-02 22:55:01 +03:00
parent 2bee49947a
commit e1f934884e
36 changed files with 2035 additions and 278 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev --port 3000",
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
-79
View File
@@ -1,79 +0,0 @@
<script lang="ts">
import { client } from "$lib/client";
const session = client.$session;
</script>
<div
style="display: flex; min-height: 100vh; align-items: center; justify-content: center;"
>
<div
style="display: flex; flex-direction: column; gap: 10px; border-radius: 10px; border: 1px solid #4B453F; padding: 20px; margin-top: 10px;"
>
<div>
{#if $session}
<div>
<p>
{$session?.user.name}
</p>
<p>
{$session?.user.email}
</p>
<button
on:click={async () => {
await client.signOut();
}}
>
Signout
</button>
</div>
{:else}
<button
on:click={async () => {
await client.signIn.social({
provider: "github",
});
}}
>
Continue with github
</button>
{/if}
</div>
</div>
</div>
<style>
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
</style>
+3
View File
@@ -0,0 +1,3 @@
export async function load(request: Request) {
return null;
}
+5
View File
@@ -0,0 +1,5 @@
<script lang="ts">
import { client } from "$lib/client";
export let data;
</script>
+19
View File
@@ -0,0 +1,19 @@
import { auth } from "$lib/auth";
export async function load(request: Request) {
const session = await auth.api.getSession({
headers: request.headers,
});
if (!session) {
return {
status: 401,
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
error: "Unauthorized",
}),
};
}
return session;
}
+3
View File
@@ -3,4 +3,7 @@ import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()],
optimizeDeps: {
exclude: ["@node-rs/argon2", "@node-rs/bcrypt"],
},
});