Skip to content

Commit

Permalink
Merge branch 'main' into kevin_cai/Add_schema_to_supabase
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanAuyeung committed Oct 8, 2023
2 parents 72c05f8 + a7c61f9 commit 84e1dd8
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 8 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',
},
};
23 changes: 23 additions & 0 deletions src/api/supabase/auth/auth.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable */

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();
};
File renamed without changes.
37 changes: 37 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,12 @@ import {
Button,
} from './styles';

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

export default function App() {
return (
<main>
Expand All @@ -32,3 +39,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 84e1dd8

Please sign in to comment.