diff --git a/.storybook/main.js b/.storybook/main.js
index f073993..ac09545 100644
--- a/.storybook/main.js
+++ b/.storybook/main.js
@@ -13,4 +13,4 @@ const config = {
options: {}
}
};
-export default config;
\ No newline at end of file
+export default config;
diff --git a/.storybook/preview.js b/.storybook/preview.js
index 747af9c..39cfdc4 100644
--- a/.storybook/preview.js
+++ b/.storybook/preview.js
@@ -10,4 +10,4 @@ const preview = {
}
};
-export default preview;
\ No newline at end of file
+export default preview;
diff --git a/src/app.css b/src/app.css
index 414ab1e..6e18abd 100644
--- a/src/app.css
+++ b/src/app.css
@@ -16,4 +16,4 @@ h2 {
h3 {
@apply font-display text-2xl;
-}
\ No newline at end of file
+}
diff --git a/src/app.d.ts b/src/app.d.ts
index bb055d9..7cce717 100644
--- a/src/app.d.ts
+++ b/src/app.d.ts
@@ -2,10 +2,9 @@
// for information about these interfaces
declare global {
namespace App {
-
// interface Error {}
interface Locals {
- user: import("lucia").User | null;
+ user: import('lucia').User | null;
session: import('lucia').Session | null;
}
// interface PageData {}
diff --git a/src/lib/components/Button.stories.svelte b/src/lib/components/Button.stories.svelte
index 9403409..30acf99 100644
--- a/src/lib/components/Button.stories.svelte
+++ b/src/lib/components/Button.stories.svelte
@@ -27,4 +27,4 @@
});
-
\ No newline at end of file
+
diff --git a/src/lib/components/Button.svelte b/src/lib/components/Button.svelte
index 2c8737a..509dca6 100644
--- a/src/lib/components/Button.svelte
+++ b/src/lib/components/Button.svelte
@@ -48,4 +48,4 @@
.button--secondary {
@apply bg-blue-600 text-white;
}
-
\ No newline at end of file
+
diff --git a/src/lib/components/Input.stories.svelte b/src/lib/components/Input.stories.svelte
index f3810b9..fffdf4c 100644
--- a/src/lib/components/Input.stories.svelte
+++ b/src/lib/components/Input.stories.svelte
@@ -40,4 +40,4 @@
-
\ No newline at end of file
+
diff --git a/src/lib/components/Input.svelte b/src/lib/components/Input.svelte
index 4b58ee1..5b3412b 100644
--- a/src/lib/components/Input.svelte
+++ b/src/lib/components/Input.svelte
@@ -33,4 +33,4 @@
all: unset;
@apply text-lg;
}
-
\ No newline at end of file
+
diff --git a/src/lib/components/Loader.stories.svelte b/src/lib/components/Loader.stories.svelte
index 27ef46b..c3957e3 100644
--- a/src/lib/components/Loader.stories.svelte
+++ b/src/lib/components/Loader.stories.svelte
@@ -9,4 +9,4 @@
});
-
\ No newline at end of file
+
diff --git a/src/lib/components/Loader.svelte b/src/lib/components/Loader.svelte
index b855fec..425d59e 100644
--- a/src/lib/components/Loader.svelte
+++ b/src/lib/components/Loader.svelte
@@ -48,4 +48,4 @@
transform: rotate(-360deg);
}
}
-
\ No newline at end of file
+
diff --git a/src/lib/components/Navbar.stories.svelte b/src/lib/components/Navbar.stories.svelte
index fe5c161..261a1ad 100644
--- a/src/lib/components/Navbar.stories.svelte
+++ b/src/lib/components/Navbar.stories.svelte
@@ -9,4 +9,4 @@
});
-
\ No newline at end of file
+
diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte
index bb75025..401699f 100644
--- a/src/lib/components/Navbar.svelte
+++ b/src/lib/components/Navbar.svelte
@@ -28,4 +28,4 @@
.navbar h2 {
@apply text-xl;
}
-
\ No newline at end of file
+
diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts
index 1689ba6..10aa007 100644
--- a/src/lib/components/index.ts
+++ b/src/lib/components/index.ts
@@ -1 +1 @@
-export * from './Navbar.svelte';
\ No newline at end of file
+export * from './Navbar.svelte';
diff --git a/src/lib/index.ts b/src/lib/index.ts
index e5efcb2..aa2aa7e 100644
--- a/src/lib/index.ts
+++ b/src/lib/index.ts
@@ -1,2 +1,2 @@
// place files you want to import through the `$lib` alias in this folder.
-export * from './components';
\ No newline at end of file
+export * from './components';
diff --git a/src/lib/server/config/index.ts b/src/lib/server/config/index.ts
index b7dcdbe..52d0661 100644
--- a/src/lib/server/config/index.ts
+++ b/src/lib/server/config/index.ts
@@ -21,4 +21,4 @@ export const LoadConfig = (): Configuration => {
};
};
-export const Config = LoadConfig();
\ No newline at end of file
+export const Config = LoadConfig();
diff --git a/src/lib/server/logger/index.ts b/src/lib/server/logger/index.ts
index 38ed4aa..ca9940c 100644
--- a/src/lib/server/logger/index.ts
+++ b/src/lib/server/logger/index.ts
@@ -20,4 +20,4 @@ export const yogaLogger: YogaLogger = {
// @ts-expect-error types dont match
logger.error(...args);
}
-};
\ No newline at end of file
+};
diff --git a/src/lib/server/lucia.ts b/src/lib/server/lucia.ts
index f93f932..bd697c2 100644
--- a/src/lib/server/lucia.ts
+++ b/src/lib/server/lucia.ts
@@ -1,32 +1,32 @@
-import { Lucia } from "lucia";
-import { PrismaAdapter } from "@lucia-auth/adapter-prisma";
-import { PrismaClient } from "@prisma/client";
+import { Lucia } from 'lucia';
+import { PrismaAdapter } from '@lucia-auth/adapter-prisma';
+import { PrismaClient } from '@prisma/client';
const client = new PrismaClient();
-const adapter = new PrismaAdapter(client.session, client.user)
+const adapter = new PrismaAdapter(client.session, client.user);
// expect error (see next section)
export const auth = new Lucia(adapter, {
- sessionCookie: {
- attributes: {
- secure: process.env.NODE_ENV === "production"
- }
- },
- getUserAttributes: (attributes)=>{
- return {
- email: attributes.email
- }
- }
+ sessionCookie: {
+ attributes: {
+ secure: process.env.NODE_ENV === 'production'
+ }
+ },
+ getUserAttributes: (attributes) => {
+ return {
+ email: attributes.email
+ };
+ }
});
-declare module "lucia" {
- interface Register {
- Lucia: typeof Lucia;
- DatabaseUserAttributes: DatabaseUserAttributes
- }
+declare module 'lucia' {
+ interface Register {
+ Lucia: typeof Lucia;
+ DatabaseUserAttributes: DatabaseUserAttributes;
+ }
}
interface DatabaseUserAttributes {
- email: string
+ email: string;
}
-export type Auth = typeof auth;
\ No newline at end of file
+export type Auth = typeof auth;
diff --git a/src/lib/server/pothos/builder.ts b/src/lib/server/pothos/builder.ts
index 0b7fda4..e048b74 100644
--- a/src/lib/server/pothos/builder.ts
+++ b/src/lib/server/pothos/builder.ts
@@ -25,4 +25,4 @@ export const builder = new SchemaBuilder({
// warn when not using a query parameter correctly
onUnusedQuery: process.env.NODE_ENV === 'production' ? null : 'warn'
}
-});
\ No newline at end of file
+});
diff --git a/src/lib/server/pothos/index.ts b/src/lib/server/pothos/index.ts
index 5d5aa13..e27a6e2 100644
--- a/src/lib/server/pothos/index.ts
+++ b/src/lib/server/pothos/index.ts
@@ -1 +1 @@
-export * from './schema';
\ No newline at end of file
+export * from './schema';
diff --git a/src/lib/server/pothos/schema/Scalars/Date.ts b/src/lib/server/pothos/schema/Scalars/Date.ts
index 6573f0a..66c652c 100644
--- a/src/lib/server/pothos/schema/Scalars/Date.ts
+++ b/src/lib/server/pothos/schema/Scalars/Date.ts
@@ -11,4 +11,4 @@ export const DateScalar = builder.scalarType('Date', {
}
return new Date(date);
}
-});
\ No newline at end of file
+});
diff --git a/src/lib/server/pothos/schema/Scalars/index.ts b/src/lib/server/pothos/schema/Scalars/index.ts
index 0751f41..337b487 100644
--- a/src/lib/server/pothos/schema/Scalars/index.ts
+++ b/src/lib/server/pothos/schema/Scalars/index.ts
@@ -5,4 +5,4 @@ export type Scalars = {
Input: Date;
Output: Date;
};
-};
\ No newline at end of file
+};
diff --git a/src/lib/server/pothos/schema/index.ts b/src/lib/server/pothos/schema/index.ts
index acdab44..f9bc62a 100644
--- a/src/lib/server/pothos/schema/index.ts
+++ b/src/lib/server/pothos/schema/index.ts
@@ -15,4 +15,4 @@ import './Scalars';
import './posts';
import './users';
-export const Schema = builder.toSchema();
\ No newline at end of file
+export const Schema = builder.toSchema();
diff --git a/src/lib/server/pothos/schema/posts.ts b/src/lib/server/pothos/schema/posts.ts
index f616871..acf8656 100644
--- a/src/lib/server/pothos/schema/posts.ts
+++ b/src/lib/server/pothos/schema/posts.ts
@@ -107,4 +107,4 @@ builder.mutationFields((t) => ({
return post;
}
})
-}));
\ No newline at end of file
+}));
diff --git a/src/lib/server/pothos/schema/users.ts b/src/lib/server/pothos/schema/users.ts
index c15b8bb..7a44d38 100644
--- a/src/lib/server/pothos/schema/users.ts
+++ b/src/lib/server/pothos/schema/users.ts
@@ -80,4 +80,4 @@ builder.mutationFields((t) => ({
return post;
}
})
-}));
\ No newline at end of file
+}));
diff --git a/src/lib/server/prisma/index.ts b/src/lib/server/prisma/index.ts
index fbb7b51..9b6c4ce 100644
--- a/src/lib/server/prisma/index.ts
+++ b/src/lib/server/prisma/index.ts
@@ -1,3 +1,3 @@
import { PrismaClient } from '@prisma/client';
-export const prisma = new PrismaClient();
\ No newline at end of file
+export const prisma = new PrismaClient();
diff --git a/src/lib/server/yoga/context.ts b/src/lib/server/yoga/context.ts
index 8a3ab51..8758829 100644
--- a/src/lib/server/yoga/context.ts
+++ b/src/lib/server/yoga/context.ts
@@ -4,4 +4,4 @@ import type { YogaInitialContext } from 'graphql-yoga';
export const Context = (initialContext: YogaInitialContext) => ({
...initialContext,
config: Config
-});
\ No newline at end of file
+});
diff --git a/src/lib/server/yoga/index.ts b/src/lib/server/yoga/index.ts
index b489ffb..8e2b5fb 100644
--- a/src/lib/server/yoga/index.ts
+++ b/src/lib/server/yoga/index.ts
@@ -1,2 +1,2 @@
export * from './context';
-export * from './server';
\ No newline at end of file
+export * from './server';
diff --git a/src/lib/server/yoga/server.ts b/src/lib/server/yoga/server.ts
index 4bdfbe6..e518428 100644
--- a/src/lib/server/yoga/server.ts
+++ b/src/lib/server/yoga/server.ts
@@ -11,4 +11,4 @@ export const Yoga = createYoga({
// Let Yoga use sveltekit's Response object
fetchAPI: { Response },
logging: yogaLogger
-});
\ No newline at end of file
+});
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 1a20558..82dff47 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -11,4 +11,4 @@
.layout {
@apply h-screen w-screen animate-fade bg-slate-100;
}
-
\ No newline at end of file
+
diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts
index 614de2d..6d00107 100644
--- a/src/routes/+page.server.ts
+++ b/src/routes/+page.server.ts
@@ -15,4 +15,4 @@ export async function load(event) {
return {
authenticated: !!user
};
-}
\ No newline at end of file
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 2a4c1a0..d0d7a7f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -21,4 +21,4 @@
.site-loader {
@apply flex h-screen w-screen flex-col items-center justify-center gap-6;
}
-
\ No newline at end of file
+
diff --git a/src/routes/api/graphql/+server.ts b/src/routes/api/graphql/+server.ts
index c208143..e1eead7 100644
--- a/src/routes/api/graphql/+server.ts
+++ b/src/routes/api/graphql/+server.ts
@@ -1,3 +1,3 @@
import { Yoga } from '$lib/server/yoga';
-export { Yoga as GET, Yoga as POST };
\ No newline at end of file
+export { Yoga as GET, Yoga as POST };
diff --git a/src/routes/app/+layout.svelte b/src/routes/app/+layout.svelte
index b0005e0..26d95b7 100644
--- a/src/routes/app/+layout.svelte
+++ b/src/routes/app/+layout.svelte
@@ -5,4 +5,4 @@
-{@render children()}
\ No newline at end of file
+{@render children()}
diff --git a/src/routes/login/+page.server.ts b/src/routes/login/+page.server.ts
index 6c6e9a1..8de0409 100644
--- a/src/routes/login/+page.server.ts
+++ b/src/routes/login/+page.server.ts
@@ -1,7 +1,7 @@
import { logger } from '$lib/server/logger';
import { prisma } from '$lib/server/prisma';
import { error, redirect, type Actions } from '@sveltejs/kit';
-import { Argon2id } from "oslo/password"
+import { Argon2id } from 'oslo/password';
import { auth } from '$lib/server/lucia.js';
export const actions = {
@@ -19,12 +19,12 @@ export const actions = {
logger.error('User not found! ${user}');
return error(401);
}
- const pw = form.get('password') as string;
- if(!pw) {
- return error(401, 'Password is required')
+ const password = form.get('password') as string;
+ if (!password) {
+ return error(401, 'Password is required');
}
- const validPassword = await new Argon2id().verify(user.password,pw);
- if(!validPassword) {
+ const validPassword = await new Argon2id().verify(user.password, password);
+ if (!validPassword) {
return error(400, 'Password is incorrect!');
}
const session = await auth.createSession(user.id, []);
@@ -36,14 +36,12 @@ export const actions = {
redirect(302, '/');
},
-
-
register: async (event) => {
const form = await event.request.formData();
if (!form.has('email') || !form.has('name') || !form.has('password')) {
return error(400);
}
- const hashedPassword = await new Argon2id().hash(form.get('password') as string)
+ const hashedPassword = await new Argon2id().hash(form.get('password') as string);
const user = await prisma.user.create({
data: {
email: form.get('email') as string,
@@ -61,6 +59,5 @@ export const actions = {
maxAge: 120
});
redirect(302, '/');
-
}
-} satisfies Actions;
\ No newline at end of file
+} satisfies Actions;
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 575e6fd..64efc22 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -22,4 +22,4 @@ export default {
},
plugins: [typography]
-} satisfies Config;
\ No newline at end of file
+} satisfies Config;