learnhouse/front/app/_orgs/[orgslug]/signup/page.tsx

48 lines
1.4 KiB
TypeScript

"use client";
import React from "react";
import { Title } from "../../../../components/UI/Elements/Styles/Title";
import { signup } from "../../../../services/auth/auth";
const SignUp = (params : any) => {
const org_slug = params.params.orgslug;
const [email, setEmail] = React.useState("");
const [password, setPassword] = React.useState("");
const [username, setUsername] = React.useState("");
const handleSubmit = (e: any) => {
e.preventDefault();
console.log({ email, password, username, org_slug });
alert(JSON.stringify({ email, password, username, org_slug }));
signup({ email, password, username, org_slug });
};
const handleEmailChange = (e: any) => {
setEmail(e.target.value);
};
const handlePasswordChange = (e: any) => {
setPassword(e.target.value);
};
const handleUsernameChange = (e: any) => {
setUsername(e.target.value);
};
return (
<div>
<div title="Sign up">
<Title>Sign up </Title>
<form>
<input onChange={handleUsernameChange} type="text" placeholder="username" />
<input onChange={handleEmailChange} type="text" placeholder="email" />
<input onChange={handlePasswordChange} type="password" placeholder="password" />
<button onClick={handleSubmit} type="submit">
Sign up
</button>
</form>
</div>
</div>
);
};
export default SignUp;