Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: fix unintended redirection on post in SvelteKit example (#20072)

JALAL247de3b4e26b
diff --git a/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx b/apps/docs/pages/guides/auth/auth-helpers/sveltekit.mdx
index 980f3f9dbcd..cf6c6c0acc4 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