From 46eb892f51b212a057386ad99fc4a1e862d0f005 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Fri, 8 Nov 2024 19:53:34 +0200 Subject: [PATCH] Renamed server.js to server.ts in /api/auth/login --- src/routes/api/auth/login/{+server.js => +server.ts} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename src/routes/api/auth/login/{+server.js => +server.ts} (81%) diff --git a/src/routes/api/auth/login/+server.js b/src/routes/api/auth/login/+server.ts similarity index 81% rename from src/routes/api/auth/login/+server.js rename to src/routes/api/auth/login/+server.ts index 413fecb..4cb994f 100644 --- a/src/routes/api/auth/login/+server.js +++ b/src/routes/api/auth/login/+server.ts @@ -1,8 +1,9 @@ // src/routes/api/auth/login/+server.ts import { json } from '@sveltejs/kit'; import { login } from '$lib/api'; +import type { PageServerLoad } from '../../../test2/$types'; -export async function POST({ request, cookies }) { +export const POST: PageServerLoad = async ({ request, cookies }) => { console.log("in POST1") const authToken = request.headers.get('App-Token'); console.log("authToken = ", authToken) @@ -22,7 +23,7 @@ export async function POST({ request, cookies }) { console.log("in POST5") return json({ id: loginResponse.id, name: loginResponse.name }); } catch (error) { - return json({ error: error.message }, { status: 401 }); + return json({ error: error }, { status: 401 }); } }