diff --git a/.eslintrc.js b/.eslintrc.js index 9f6eb0b8..0f2c600d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,9 @@ module.exports = { - extends: ["@calblueprint/eslint-config-react", "eslint:recommended", "plugin:react/recommended", "plugin:prettier/recommended"], - 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 5addaf53..78f7e55f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.1.0", "dependencies": { "@calblueprint/prettier-config": "^0.0.1", + "@supabase/auth-helpers-nextjs": "^0.8.1", "@supabase/supabase-js": "^2.37.0", "@types/node": "20.6.3", "@types/react": "18.2.22", @@ -347,6 +348,29 @@ "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.5.1.tgz", "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==" }, + "node_modules/@supabase/auth-helpers-nextjs": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@supabase/auth-helpers-nextjs/-/auth-helpers-nextjs-0.8.1.tgz", + "integrity": "sha512-ZO/UGDE9oaVXwPL4gpzGu2NpPwfKOgxTUnuK6no51So8Ah9BUuUUsTj+BdZlx7jJoZEIAkHWdRIx65WuQgWAiQ==", + "dependencies": { + "@supabase/auth-helpers-shared": "0.5.0", + "set-cookie-parser": "^2.6.0" + }, + "peerDependencies": { + "@supabase/supabase-js": "^2.19.0" + } + }, + "node_modules/@supabase/auth-helpers-shared": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@supabase/auth-helpers-shared/-/auth-helpers-shared-0.5.0.tgz", + "integrity": "sha512-kioUeYDBZ89cfqOTZFOLEFIO7kGczL0XJYZdVv/bKt5efXqhiY14NbzgGWiMvvD9o9Iluo0+YEV2tG3ZZ5W06A==", + "dependencies": { + "jose": "^4.14.4" + }, + "peerDependencies": { + "@supabase/supabase-js": "^2.19.0" + } + }, "node_modules/@supabase/functions-js": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@supabase/functions-js/-/functions-js-2.1.5.tgz", @@ -2554,6 +2578,14 @@ "set-function-name": "^2.0.1" } }, + "node_modules/jose": { + "version": "4.14.6", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.6.tgz", + "integrity": "sha512-EqJPEUlZD0/CSUMubKtMaYUOtWe91tZXTWMJZoKSbLk+KtdhNdcvppH8lA9XwVu2V4Ailvsj0GBZJ2ZwDjfesQ==", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3321,6 +3353,11 @@ "node": ">=10" } }, + "node_modules/set-cookie-parser": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", + "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" + }, "node_modules/set-function-name": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", diff --git a/package.json b/package.json index 2cc4f905..abc15ebc 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@calblueprint/prettier-config": "^0.0.1", + "@supabase/auth-helpers-nextjs": "^0.8.1", "@supabase/supabase-js": "^2.37.0", "@types/node": "20.6.3", "@types/react": "18.2.22", diff --git a/src/api/supabase/auth/auth.ts b/src/api/supabase/auth/auth.ts new file mode 100644 index 00000000..c37b9e03 --- /dev/null +++ b/src/api/supabase/auth/auth.ts @@ -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(); +}; diff --git a/src/api/supabase/queries /createClient.ts b/src/api/supabase/createClient.ts similarity index 94% rename from src/api/supabase/queries /createClient.ts rename to src/api/supabase/createClient.ts index e576c68f..53892337 100644 --- a/src/api/supabase/queries /createClient.ts +++ b/src/api/supabase/createClient.ts @@ -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 80589675..8815ba1b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,22 +1,22 @@ -import './globals.css' -import type { Metadata } from 'next' -import { Inter } from 'next/font/google' +import './globals.css'; +import type { Metadata } from 'next'; +import { Inter } from 'next/font/google'; -const inter = Inter({ subsets: ['latin'] }) +const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { title: 'Shanti Project', description: 'Application Created by Blueprint', -} +}; export default function RootLayout({ children, }: { - children: React.ReactNode + children: React.ReactNode; }) { return ( {children} - ) + ); } diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx new file mode 100644 index 00000000..b1613cb9 --- /dev/null +++ b/src/app/login/page.tsx @@ -0,0 +1,38 @@ +'use client'; + +import { useState } from 'react'; +import { + handleSignUp, + signInWithEmail, + signOut, +} from '../../api/supabase/auth/auth'; + +export default function Login() { + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + + return ( + <> + setEmail(e.target.value)} + value={email} + /> + setPassword(e.target.value)} + value={password} + /> + + + + + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx deleted file mode 100644 index 9ddf9b95..00000000 --- a/src/app/page.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import Image from 'next/image' -import styles from './page.module.css' - -export default function Home() { - return ( -
-
-

- Get started by editing  - src/app/page.tsx -

-
- - By{' '} - Vercel Logo - -
-
- -
- Next.js Logo -
- -
- -

- Docs -> -

-

Find in-depth information about Next.js features and API.

-
- - -

- Learn -> -

-

Learn about Next.js in an interactive course with quizzes!

-
- - -

- Templates -> -

-

Explore the Next.js 13 playground.

-
- - -

- Deploy -> -

-

- Instantly deploy your Next.js site to a shareable URL with Vercel. -

-
-
-
- ) -} diff --git a/tsconfig.json b/tsconfig.json index 80b29d1b..90e5f9d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,11 @@ { "compilerOptions": { "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], + "lib": [ + "dom", + "dom.iterable", + "esnext" + ], "allowJs": true, "skipLibCheck": true, "strict": true, @@ -19,7 +23,19 @@ } ], "paths": { - "@/*": ["./src/*"] - } + "@/*": [ + "./src/*" + ] + }, + "forceConsistentCasingInFileNames": true }, -} \ No newline at end of file + "include": [ + "next-env.d.ts", + ".next/types/**/*.ts", + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +}