Skip to content

Commit

Permalink
pulled from main and added files from previous branch
Browse files Browse the repository at this point in the history
  • Loading branch information
celinechoiii committed Oct 8, 2023
1 parent e428f1e commit b1ea1fe
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 12 deletions.
16 changes: 8 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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',
},
};
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',
},
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 21 additions & 0 deletions src/api/supabase/auth/auth.tsx
Original file line number Diff line number Diff line change
@@ -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();
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
);

export default supabase;
export default supabase;
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ export default function RootLayout({
<body className={inter.className}>{children}</body>
</html>
);
}
}
38 changes: 38 additions & 0 deletions src/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { useState } from 'react';
import Link from 'next/link';
import LoginForm from '../../components/LoginForm';

Expand All @@ -13,6 +14,13 @@ import {
Button,
} from './styles';

import {
handleSignUp,
signInWithEmail,
signOut,
} from '../../api/supabase/auth/auth';


export default function App() {
return (
<main>
Expand All @@ -32,3 +40,33 @@ export default function App() {
</main>
);
}

export function Login() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');

return (
<>
<input
name="email"
onChange={e => setEmail(e.target.value)}
value={email}
/>
<input
type="password"
name="password"
onChange={e => setPassword(e.target.value)}
value={password}
/>
<button type="button" onClick={() => handleSignUp(email, password)}>
Sign up
</button>
<button type="button" onClick={() => signInWithEmail(email, password)}>
Sign in
</button>
<button type="button" onClick={signOut}>
Sign out
</button>
</>
);
}

0 comments on commit b1ea1fe

Please sign in to comment.