From 906509aa03bab7bd3bba8af54d40026061d3f562 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 12 Apr 2024 18:11:28 -0400 Subject: [PATCH] removed supabase assets. install appwrite (#125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![Screenshot 2024-04-10 at 7 16 41 PM](https://github.com/LetsGetTechnical/gridiron-survivor/assets/110337114/497c4545-9294-4c97-8441-731b5a69e5b6) removed from package.json all supabase removed the storybook assets removed the supabase.ts files renamed the folder to appwrite installed appwrite --------- Co-authored-by: Shashi Lo <362527+shashilo@users.noreply.github.com> Co-authored-by: Mike Chen <1325549+mhchen@users.noreply.github.com> --- app/auth/callback/route.ts | 20 +- app/layout.tsx | 4 +- app/login/page.tsx | 114 +- app/page.tsx | 43 +- components/AuthButton.tsx | 38 +- middleware.ts | 19 +- package-lock.json | 20068 ------------------------- package.json | 5 +- pnpm-lock.yaml | 147 +- stories/assets/supabase_gridIron.png | Bin 32238 -> 0 bytes stories/assets/supabase_server.png | Bin 50704 -> 0 bytes utils/supabase/client.ts | 7 - utils/supabase/middleware.ts | 61 - utils/supabase/server.ts | 34 - 14 files changed, 90 insertions(+), 20470 deletions(-) delete mode 100644 package-lock.json delete mode 100644 stories/assets/supabase_gridIron.png delete mode 100644 stories/assets/supabase_server.png delete mode 100644 utils/supabase/client.ts delete mode 100644 utils/supabase/middleware.ts delete mode 100644 utils/supabase/server.ts diff --git a/app/auth/callback/route.ts b/app/auth/callback/route.ts index 38226319..cefb1183 100644 --- a/app/auth/callback/route.ts +++ b/app/auth/callback/route.ts @@ -1,20 +1,8 @@ -import { createClient } from '@/utils/supabase/server' -import { NextResponse } from 'next/server' -import { cookies } from 'next/headers' +import { NextResponse } from 'next/server'; export async function GET(request: Request) { - // The `/auth/callback` route is required for the server-side auth flow implemented - // by the Auth Helpers package. It exchanges an auth code for the user's session. - // https://supabase.com/docs/guides/auth/auth-helpers/nextjs#managing-sign-in-with-code-exchange - const requestUrl = new URL(request.url) - const code = requestUrl.searchParams.get('code') + const requestUrl = new URL(request.url); + const code = requestUrl.searchParams.get('code'); - if (code) { - const cookieStore = cookies() - const supabase = createClient(cookieStore) - await supabase.auth.exchangeCodeForSession(code) - } - - // URL to redirect to after sign in process completes - return NextResponse.redirect(requestUrl.origin) + return NextResponse.redirect(requestUrl.origin); } diff --git a/app/layout.tsx b/app/layout.tsx index 4696a572..e8c67526 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -7,8 +7,8 @@ const defaultUrl = process.env.VERCEL_URL export const metadata = { metadataBase: new URL(defaultUrl), - title: 'Next.js and Supabase Starter Kit', - description: 'The fastest way to build apps with Next.js and Supabase', + title: 'Next.js and Appwrite', + description: 'The fastest way to build apps with Next.js and Appwrite' } export default function RootLayout({ diff --git a/app/login/page.tsx b/app/login/page.tsx index 636a0512..095470aa 100644 --- a/app/login/page.tsx +++ b/app/login/page.tsx @@ -1,118 +1,14 @@ -import Link from 'next/link' -import { headers, cookies } from 'next/headers' -import { createClient } from '@/utils/supabase/server' -import { redirect } from 'next/navigation' +import Link from 'next/link'; +import { redirect } from 'next/navigation'; export default function Login({ searchParams, }: { - searchParams: { message: string } + searchParams: { message: string }; }) { - const signIn = async (formData: FormData) => { - 'use server' - - const email = formData.get('email') as string - const password = formData.get('password') as string - const cookieStore = cookies() - const supabase = createClient(cookieStore) - - const { error } = await supabase.auth.signInWithPassword({ - email, - password, - }) - - if (error) { - return redirect('/login?message=Could not authenticate user') - } - - return redirect('/') - } - - const signUp = async (formData: FormData) => { - 'use server' - - const origin = headers().get('origin') - const email = formData.get('email') as string - const password = formData.get('password') as string - const cookieStore = cookies() - const supabase = createClient(cookieStore) - - const { error } = await supabase.auth.signUp({ - email, - password, - options: { - emailRedirectTo: `${origin}/auth/callback`, - }, - }) - - if (error) { - return redirect('/login?message=Could not authenticate user') - } - - return redirect('/login?message=Check email to continue sign in process') - } - return (
- - - - {' '} - Back - - -
- - - - - - - {searchParams?.message && ( -

- {searchParams.message} -

- )} -
+

Hello GIS

- ) + ); } diff --git a/app/page.tsx b/app/page.tsx index b6bfb98f..31223b6e 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,43 +1,12 @@ -import AuthButton from '../components/AuthButton' -import { createClient } from '@/utils/supabase/server' -import { cookies } from 'next/headers' - -export default async function Index() { - const cookieStore = cookies() - - const canInitSupabaseClient = () => { - // This function is just for the interactive tutorial. - // Feel free to remove it once you have Supabase connected. - try { - createClient(cookieStore) - return true - } catch (e) { - return false - } - } - - const isSupabaseConnected = canInitSupabaseClient() +import AuthButton from '../components/AuthButton'; +export default function Index() { return ( -
-