From 247de3b4e26b521422ea88ce50558656ad2247cc Mon Sep 17 00:00:00 2001 From: JALAL Date: Wed, 3 Jan 2024 19:19:04 +0100 Subject: [PATCH] docs: fix unintended redirection on post in SvelteKit example (#20072) fixes unintended redirection on unauthorized post in SvelteKit example Co-authored-by: Charis <26616127+charislam@users.noreply.github.com> --- apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx b/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx index 980f3f9dbc..cf6c6c0acc 100644 --- a/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx +++ b/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx @@ -633,7 +633,7 @@ async function supabase({ event, resolve }) { async function authorization({ event, resolve }) { // protect requests to all routes that start with /protected-routes - if (event.url.pathname.startsWith('/protected-routes')) { + if (event.url.pathname.startsWith('/protected-routes') && event.request.method === 'GET') { const session = await event.locals.getSession() if (!session) { // the user is not signed in @@ -695,7 +695,7 @@ async function supabase({ event, resolve }) { async function authorization({ event, resolve }) { // protect requests to all routes that start with /protected-routes - if (event.url.pathname.startsWith('/protected-routes')) { + if (event.url.pathname.startsWith('/protected-routes') && event.request.method === 'GET') { const session = await event.locals.getSession() if (!session) { // the user is not signed in