From 444d7945473d638301b70de2b5603e7d4a6ab7d4 Mon Sep 17 00:00:00 2001 From: Idan Gazit Date: Thu, 4 Jul 2024 13:53:53 +0300 Subject: [PATCH] Try non-actions --- src/routes/auth/+page.server.ts | 44 +++++++++++++++++++-------------- src/routes/auth/+page.svelte | 3 ++- src/routes/auth/+server.ts | 6 +++++ 3 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 src/routes/auth/+server.ts diff --git a/src/routes/auth/+page.server.ts b/src/routes/auth/+page.server.ts index d834beb..cdd6a78 100644 --- a/src/routes/auth/+page.server.ts +++ b/src/routes/auth/+page.server.ts @@ -1,23 +1,29 @@ -import type { Actions } from './$types'; +// // import type { Actions } from './$types'; +// import { json } from '@sveltejs/kit'; +// import type { RequestHandler } from './$types'; +// // import { ApplicationInsights } from '@microsoft/applicationinsights-web' -import { ApplicationInsights } from '@microsoft/applicationinsights-web' +// // import { env } from '$env/dynamic/private'; -import { env } from '$env/dynamic/private'; +// // let appInsights: ApplicationInsights; +// // if ('APPLICATIONINSIGHTS_CONNECTION_STRING' in env) { +// // appInsights = new ApplicationInsights({ config: { +// // connectionString: env.APPLICATIONINSIGHTS_CONNECTION_STRING +// // } }); +// // } -let appInsights: ApplicationInsights; -if ('APPLICATIONINSIGHTS_CONNECTION_STRING' in env) { - appInsights = new ApplicationInsights({ config: { - connectionString: env.APPLICATIONINSIGHTS_CONNECTION_STRING - } }); -} -export const actions = { - login: async (event) => { - console.error("THE EVENT: ", event, event.request); - appInsights?.trackTrace({message: 'login event', properties: {event}}); - return {action: 'login'}; - }, - logout: async (event) => { - return {action: 'logout'}; - }, -} satisfies Actions; \ No newline at end of file +// // export const actions = { +// // login: async (event) => { +// // console.error("THE EVENT: ", event, event.request); +// // appInsights?.trackTrace({message: 'login event', properties: {event}}); +// // return {action: 'login'}; +// // }, +// // logout: async (event) => { +// // return {action: 'logout'}; +// // }, +// // } satisfies Actions; + +// export const fallback: RequestHandler = async ({request}) => { +// return json(request); +// } \ No newline at end of file diff --git a/src/routes/auth/+page.svelte b/src/routes/auth/+page.svelte index 4e35f6e..cbeabb0 100644 --- a/src/routes/auth/+page.svelte +++ b/src/routes/auth/+page.svelte @@ -5,4 +5,5 @@ export let form: ActionData; -
Form action: {form?.action}
+ +
Form action: nada
diff --git a/src/routes/auth/+server.ts b/src/routes/auth/+server.ts new file mode 100644 index 0000000..923adf3 --- /dev/null +++ b/src/routes/auth/+server.ts @@ -0,0 +1,6 @@ +import { json } from '@sveltejs/kit'; +import type { RequestHandler } from './$types'; + +export const fallback: RequestHandler = async ({request, platform}) => { + return json({request, platform}); +} \ No newline at end of file