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>
This commit is contained in:
JALAL
2024-01-03 19:19:04 +01:00
committed by GitHub
parent 245c127805
commit 247de3b4e2

View File

@@ -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