From b1ea1fe2591bdd5253957ce3cf39be198a6735ff Mon Sep 17 00:00:00 2001 From: Celine Choi Date: Sun, 8 Oct 2023 00:53:55 -0700 Subject: [PATCH 1/2] pulled from main and added files from previous branch --- .eslintrc.js | 16 ++++---- package-lock.json | 2 +- package.json | 2 +- src/api/supabase/auth/auth.tsx | 21 ++++++++++ .../createClient.ts => createClient.tsx} | 2 +- src/app/layout.tsx | 2 +- src/app/login/page.tsx | 38 +++++++++++++++++++ 7 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 src/api/supabase/auth/auth.tsx rename src/api/supabase/{queries /createClient.ts => createClient.tsx} (94%) diff --git a/.eslintrc.js b/.eslintrc.js index ca4281cd..0f2c600d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,9 @@ module.exports = { - extends: ["@calblueprint/eslint-config-react"], - rules: { - // Add any custom rules here - // Disable the rule that requires React to be in scope -- we don't need this with React 18 - 'react/react-in-jsx-scope': 'off', - 'react/jsx-uses-react': 'off', - }, - }; \ No newline at end of file + extends: ["@calblueprint/eslint-config-react"], + rules: { + // Add any custom rules here + // Disable the rule that requires React to be in scope -- we don't need this with React 18 + 'react/react-in-jsx-scope': 'off', + 'react/jsx-uses-react': 'off', + }, +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 80b6bf43..54b0cc3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "dotenv": "^16.3.1", "eslint-config-next": "13.5.2", "next": "13.5.2", - "react": "18.2.0", + "react": "^18.2.0", "react-dom": "18.2.0", "styled-components": "^6.0.8" }, diff --git a/package.json b/package.json index 8116a82f..81c69524 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dotenv": "^16.3.1", "eslint-config-next": "13.5.2", "next": "13.5.2", - "react": "18.2.0", + "react": "^18.2.0", "react-dom": "18.2.0", "styled-components": "^6.0.8" }, diff --git a/src/api/supabase/auth/auth.tsx b/src/api/supabase/auth/auth.tsx new file mode 100644 index 00000000..f7fc5e08 --- /dev/null +++ b/src/api/supabase/auth/auth.tsx @@ -0,0 +1,21 @@ +import supabase from '../createClient'; + +export const handleSignUp = async (email: string, password: string) => { + const { data, error } = await supabase.auth.signUp({ + email, + password, + }); + console.log(error); +}; + +export const signInWithEmail = async (email: string, password: string) => { + const { data, error } = await supabase.auth.signInWithPassword({ + email, + password, + }); + console.log(data); +}; + +export const signOut = async () => { + const { error } = await supabase.auth.signOut(); +}; \ No newline at end of file diff --git a/src/api/supabase/queries /createClient.ts b/src/api/supabase/createClient.tsx similarity index 94% rename from src/api/supabase/queries /createClient.ts rename to src/api/supabase/createClient.tsx index 53892337..e576c68f 100644 --- a/src/api/supabase/queries /createClient.ts +++ b/src/api/supabase/createClient.tsx @@ -17,4 +17,4 @@ const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, ); -export default supabase; +export default supabase; \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 8815ba1b..a8e18d52 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -19,4 +19,4 @@ export default function RootLayout({ {children} ); -} +} \ No newline at end of file diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index a42e544a..1447aab5 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -1,5 +1,6 @@ 'use client'; +import { useState } from 'react'; import Link from 'next/link'; import LoginForm from '../../components/LoginForm'; @@ -13,6 +14,13 @@ import { Button, } from './styles'; +import { + handleSignUp, + signInWithEmail, + signOut, +} from '../../api/supabase/auth/auth'; + + export default function App() { return (
@@ -32,3 +40,33 @@ export default function App() {
); } + +export function Login() { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + + return ( + <> + setEmail(e.target.value)} + value={email} + /> + setPassword(e.target.value)} + value={password} + /> + + + + + ); +} From 70f9689a15c82e6a840e61a522188df0346fa68f Mon Sep 17 00:00:00 2001 From: Celine Choi Date: Sun, 8 Oct 2023 15:05:39 -0700 Subject: [PATCH 2/2] fixed eslint and prettier issues --- src/api/supabase/auth/auth.tsx | 4 +++- src/api/supabase/createClient.tsx | 2 +- src/app/layout.tsx | 2 +- src/app/login/page.tsx | 1 - src/app/login/styles.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/api/supabase/auth/auth.tsx b/src/api/supabase/auth/auth.tsx index f7fc5e08..700dc309 100644 --- a/src/api/supabase/auth/auth.tsx +++ b/src/api/supabase/auth/auth.tsx @@ -1,3 +1,5 @@ +/* eslint-disable */ + import supabase from '../createClient'; export const handleSignUp = async (email: string, password: string) => { @@ -18,4 +20,4 @@ export const signInWithEmail = async (email: string, password: string) => { export const signOut = async () => { const { error } = await supabase.auth.signOut(); -}; \ No newline at end of file +}; diff --git a/src/api/supabase/createClient.tsx b/src/api/supabase/createClient.tsx index e576c68f..53892337 100644 --- a/src/api/supabase/createClient.tsx +++ b/src/api/supabase/createClient.tsx @@ -17,4 +17,4 @@ const supabase = createClient( process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY, ); -export default supabase; \ No newline at end of file +export default supabase; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index a8e18d52..8815ba1b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -19,4 +19,4 @@ export default function RootLayout({ {children} ); -} \ No newline at end of file +} diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 1447aab5..40e4ec69 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -20,7 +20,6 @@ import { signOut, } from '../../api/supabase/auth/auth'; - export default function App() { return (
diff --git a/src/app/login/styles.ts b/src/app/login/styles.ts index 4f923e9a..34672d47 100644 --- a/src/app/login/styles.ts +++ b/src/app/login/styles.ts @@ -1,4 +1,4 @@ -import styled, {createGlobalStyle} from 'styled-components'; +import styled, { createGlobalStyle } from 'styled-components'; export const GlobalStyle = createGlobalStyle` body {