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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user