From e105ae9a157852d248cd0140571208adf9c1d210 Mon Sep 17 00:00:00 2001 From: Lennon Puldagrealy Date: Sun, 18 Dec 2022 20:39:47 -0800 Subject: [PATCH] Update auth methods to next-auth; Remove Supabase --- website/src/pages/_app.tsx | 11 +++----- website/src/pages/index.tsx | 12 ++------ website/src/pages/login.jsx | 34 ----------------------- website/src/pages/login.tsx | 55 +++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 51 deletions(-) delete mode 100644 website/src/pages/login.jsx create mode 100644 website/src/pages/login.tsx diff --git a/website/src/pages/_app.tsx b/website/src/pages/_app.tsx index b3081a8f..0f66425c 100644 --- a/website/src/pages/_app.tsx +++ b/website/src/pages/_app.tsx @@ -1,16 +1,13 @@ -import { createBrowserSupabaseClient } from "@supabase/auth-helpers-nextjs"; -import { SessionContextProvider } from "@supabase/auth-helpers-react"; -import { useState } from "react"; +import { SessionProvider } from "next-auth/react"; import "../styles/globals.css"; import "focus-visible"; -function MyApp({ Component, pageProps }) { - const [supabase] = useState(() => createBrowserSupabaseClient()); +function MyApp({ Component, pageProps: { session, ...pageProps } }) { return ( - + - + ); } diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx index 4117faa6..2884cc2b 100644 --- a/website/src/pages/index.tsx +++ b/website/src/pages/index.tsx @@ -1,5 +1,4 @@ -import { Auth, ThemeSupa } from "@supabase/auth-ui-react"; -import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"; +import { useSession } from "next-auth/react"; import Head from "next/head"; @@ -12,14 +11,7 @@ import { Hero } from "../components/Hero"; import styles from "../styles/Home.module.css"; export default function Home() { - const session = useSession(); - const supabase = useSupabaseClient(); - - const signinWithDiscord = async () => { - const { data, error } = await supabase.auth.signInWithOAuth({ - provider: "discord", - }); - }; + const { data: session } = useSession(); if (!session) { return ( diff --git a/website/src/pages/login.jsx b/website/src/pages/login.jsx deleted file mode 100644 index a0fef60b..00000000 --- a/website/src/pages/login.jsx +++ /dev/null @@ -1,34 +0,0 @@ -import Head from "next/head"; -import Link from "next/link"; - -import { AuthLayout } from "@/components/AuthLayout"; -import { Button } from "@/components/Button"; -import { TextField } from "@/components/Fields"; - -export default function Login() { - return ( - <> - - Log in - - }> -
-
- - -
- -
-
- - ); -} diff --git a/website/src/pages/login.tsx b/website/src/pages/login.tsx new file mode 100644 index 00000000..0f720af5 --- /dev/null +++ b/website/src/pages/login.tsx @@ -0,0 +1,55 @@ +import Head from "next/head"; +import Link from "next/link"; + +import { AuthLayout } from "../components/AuthLayout"; + +export default function Login() { + return ( + <> + + Log in + + }> +
+
+ + + +
+
+
+ + ); +}