diff --git a/src/routes/login/+page.server.ts b/src/routes/login/+page.server.ts deleted file mode 100644 index 710ee296..00000000 --- a/src/routes/login/+page.server.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Actions, PageServerLoad } from './$types' -import { fail, redirect } from '@sveltejs/kit' - -export const load: PageServerLoad = async ({ locals, url }) => { - if (locals.session.isAuthenticated) { - throw redirect(302, url.searchParams.get('next') ?? '/me') - } - return {} -} - -export const actions: Actions = { - default: async ({ request, fetch, url }) => { - const form = await request.formData() - const email = String(form.get('email') ?? '') - const password = String(form.get('password') ?? '') - - if (!email || !password) { - return fail(400, { error: 'Email and password are required', email }) - } - - const res = await fetch('/auth/login', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ email, password, grant_type: 'password' }) - }) - - if (res.ok) { - throw redirect(303, url.searchParams.get('next') ?? '/me') - } - - const j = await res.json().catch(() => ({})) - return fail(res.status, { error: j.error ?? 'Login failed', email }) - } -} diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte deleted file mode 100644 index dc6f30a6..00000000 --- a/src/routes/login/+page.svelte +++ /dev/null @@ -1,23 +0,0 @@ - - -