diff --git a/middleware.ts b/middleware.ts deleted file mode 100644 index bc75907..0000000 --- a/middleware.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { NextResponse, type NextRequest } from "next/server"; -import { createClient } from "@/utils/supabase/middleware"; - -export async function middleware(request: NextRequest) { - try { - // This `try/catch` block is only here for the interactive tutorial. - // Feel free to remove once you have Supabase connected. - const { supabase, response } = createClient(request); - - // Refresh session if expired - required for Server Components - // https://supabase.com/docs/guides/auth/auth-helpers/nextjs#managing-session-with-middleware - await supabase.auth.getSession(); - - return response; - } catch (e) { - // If you are here, a Supabase client could not be created! - // This is likely because you have not set up environment variables. - // Check out http://localhost:3000 for Next Steps. - return NextResponse.next({ - request: { - headers: request.headers, - }, - }); - } -} - -export const config = { - matcher: [ - /* - * Match all request paths except for the ones starting with: - * - _next/static (static files) - * - _next/image (image optimization files) - * - favicon.ico (favicon file) - * Feel free to modify this pattern to include more paths. - */ - "/((?!_next/static|_next/image|favicon.ico).*)", - ], -}; diff --git a/package.json b/package.json index 5176d69..a0bc816 100644 --- a/package.json +++ b/package.json @@ -9,20 +9,20 @@ "@radix-ui/react-slot": "^1.0.2", "@supabase/ssr": "latest", "@supabase/supabase-js": "latest", - "autoprefixer": "10.4.15", - "geist": "^1.0.0", + "autoprefixer": "10.4.18", + "geist": "^1.2.2", "next": "latest", - "postcss": "8.4.29", + "postcss": "8.4.35", "react": "18.2.0", "react-dom": "18.2.0", - "tailwindcss": "3.3.3", + "tailwindcss": "3.4.1", "tailwindcss-animate": "^1.0.7", - "typescript": "5.1.3" + "typescript": "5.4.2" }, "devDependencies": { - "@types/node": "20.3.1", - "@types/react": "18.2.8", - "@types/react-dom": "18.2.5", + "@types/node": "20.11.27", + "@types/react": "18.2.66", + "@types/react-dom": "18.2.22", "encoding": "^0.1.13" } } diff --git a/utils/supabase/client.ts b/utils/supabase/client.ts deleted file mode 100644 index e2660d0..0000000 --- a/utils/supabase/client.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { createBrowserClient } from "@supabase/ssr"; - -export const createClient = () => - createBrowserClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - ); diff --git a/utils/supabase/middleware.ts b/utils/supabase/middleware.ts deleted file mode 100644 index 24e61c5..0000000 --- a/utils/supabase/middleware.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { createServerClient, type CookieOptions } from "@supabase/ssr"; -import { type NextRequest, NextResponse } from "next/server"; - -export const createClient = (request: NextRequest) => { - // Create an unmodified response - let response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); - - const supabase = createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - get(name: string) { - return request.cookies.get(name)?.value; - }, - set(name: string, value: string, options: CookieOptions) { - // If the cookie is updated, update the cookies for the request and response - request.cookies.set({ - name, - value, - ...options, - }); - response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); - response.cookies.set({ - name, - value, - ...options, - }); - }, - remove(name: string, options: CookieOptions) { - // If the cookie is removed, update the cookies for the request and response - request.cookies.set({ - name, - value: "", - ...options, - }); - response = NextResponse.next({ - request: { - headers: request.headers, - }, - }); - response.cookies.set({ - name, - value: "", - ...options, - }); - }, - }, - }, - ); - - return { supabase, response }; -}; diff --git a/utils/supabase/server.ts b/utils/supabase/server.ts deleted file mode 100644 index eb27a37..0000000 --- a/utils/supabase/server.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createServerClient, type CookieOptions } from "@supabase/ssr"; -import { cookies } from "next/headers"; - -export const createClient = (cookieStore: ReturnType) => { - return createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - get(name: string) { - return cookieStore.get(name)?.value; - }, - set(name: string, value: string, options: CookieOptions) { - try { - cookieStore.set({ name, value, ...options }); - } catch (error) { - // The `set` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - remove(name: string, options: CookieOptions) { - try { - cookieStore.set({ name, value: "", ...options }); - } catch (error) { - // The `delete` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - }, - }, - ); -};