Formatting
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { createServerClient } from "@supabase/ssr";
|
||||
import { type NextRequest, NextResponse } from "next/server";
|
||||
import { createServerClient } from '@supabase/ssr';
|
||||
import { type NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export const updateSession = async (request: NextRequest) => {
|
||||
// This `try/catch` block is only here for the interactive tutorial.
|
||||
@ -40,12 +40,12 @@ export const updateSession = async (request: NextRequest) => {
|
||||
const user = await supabase.auth.getUser();
|
||||
|
||||
// protected routes
|
||||
if (request.nextUrl.pathname.startsWith("/protected") && user.error) {
|
||||
return NextResponse.redirect(new URL("/sign-in", request.url));
|
||||
if (request.nextUrl.pathname.startsWith('/protected') && user.error) {
|
||||
return NextResponse.redirect(new URL('/sign-in', request.url));
|
||||
}
|
||||
|
||||
if (request.nextUrl.pathname === "/" && !user.error) {
|
||||
return NextResponse.redirect(new URL("/protected", request.url));
|
||||
if (request.nextUrl.pathname === '/' && !user.error) {
|
||||
return NextResponse.redirect(new URL('/protected', request.url));
|
||||
}
|
||||
|
||||
return response;
|
||||
|
Reference in New Issue
Block a user