Skip to content

Commit

Permalink
Add signup
Browse files Browse the repository at this point in the history
  • Loading branch information
aleda145 committed Aug 3, 2022
1 parent 47e6618 commit 40fbbf4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions frontend/src/auth/pocketbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ export default function Auth({ client, setIsLoggedIn }) {
console.log(userData);
setIsLoggedIn(client.AuthStore.isValid);
};
const handleSignUp = async (e) => {
e.preventDefault();
const user = await client.Users.create({
email: username,
password: password,
passwordConfirm: password,
});

console.log(user);
// setIsLoggedIn(client.AuthStore.isValid);
};
return (
<div className="login-wrapper">
<h1>Please Log In</h1>
Expand All @@ -29,6 +40,23 @@ export default function Auth({ client, setIsLoggedIn }) {
<button type="submit">Submit</button>
</div>
</form>
<h2>Or sign up</h2>
<form onSubmit={handleSignUp}>
<label>
<p>Username</p>
<input type="text" onChange={(e) => setUserName(e.target.value)} />
</label>
<label>
<p>Password</p>
<input
type="password"
onChange={(e) => setPassword(e.target.value)}
/>
</label>
<div>
<button type="submit">Submit</button>
</div>
</form>
</div>
);
}
Expand Down

0 comments on commit 40fbbf4

Please sign in to comment.