123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- 'use client';
- // import Link from '@/components/Link';
- // import { useRouter } from 'next/navigation';
- // import { ChangeEvent, useState } from 'react';
- // import { signIn } from 'next-auth/react';
- export default function Signup() {
- // const router = useRouter();
- // const [loading, setLoading] = useState(false);
- // const [formValues, setFormValues] = useState({
- // name: '',
- // email: '',
- // password: '',
- // });
- // const [error, setError] = useState('');
- // const onSubmit = async (e: React.FormEvent) => {
- // e.preventDefault();
- // setLoading(true);
- // setFormValues({ name: '', email: '', password: '' });
- // try {
- // const res = await fetch('/api/register', {
- // method: 'POST',
- // body: JSON.stringify(formValues),
- // headers: {
- // 'Content-Type': 'application/json',
- // },
- // });
- // setLoading(false);
- // if (!res.ok) {
- // setError((await res.json()).message);
- // return;
- // }
- // signIn(undefined, { callbackUrl: '/' });
- // } catch (error: any) {
- // setLoading(false);
- // setError(error);
- // }
- // };
- // const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
- // const { name, value } = event.target;
- // setFormValues({ ...formValues, [name]: value });
- // };
- return (
- <>
- {/* <div className="text-center mb-4">
- <Link href="/" className="mx-auto d-inline-block logo" aria-label="Tabler" />
- </div>
- <form onSubmit={onSubmit} className="flex-column card card-md">
- <div className="card-body">
- <h2 className="card-title text-center mb-4">Create new account</h2>
- {
- error &&
- <p className="text-center" style={{color: 'red'}}>{error}</p>
- }
- <div className="mb-3">
- <label className="form-label">Name</label>
- <input
- required
- type="name"
- name="name"
- value={formValues.name}
- onChange={handleChange}
- className="form-control"
- placeholder="Name"
- />
- </div>
- <div className="mb-3">
- <label className="form-label">Email address</label>
- <input
- required
- type="email"
- name="email"
- value={formValues.email}
- onChange={handleChange}
- className="form-control"
- placeholder="Enter email"
- />
- </div>
- <div className="mb-3">
- <label className="form-label">Password</label>
- <div className="input-group input-group-flat">
- <input
- type="password"
- name="password"
- value={formValues.password}
- onChange={handleChange}
- className="form-control"
- placeholder="Password"
- />
- </div>
- </div>
- <div className="form-footer">
- <button className="btn btn-primary w-100" disabled={loading}>
- {loading ? 'loading...' : 'Create new account'}
- </button>
- </div>
- </div>
- </form>
- <div className="text-center text-secondary mt-3">
- Already have account?
- <a className="ml-2" onClick={() => router.push('/api/auth/signin')}>
- Sign in</a>
- </div> */}
- </>
- );
- }
|