Skip to content

Commit 2a5dcd2

Browse files
author
furkan.portakal
committed
fix: create register page for deploy
1 parent 1d8f0b1 commit 2a5dcd2

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

pages/auth/register.js

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// import { fetcher } from '../../lib'
2+
import useSWR from "swr";
3+
import { useRouter } from 'next/router'
4+
const fetcher = (...args) => fetch(...args).then(res => res.json())
5+
6+
export default function Register() {
7+
const router = useRouter()
8+
const { user, isLoading, isError } = useGetData()
9+
if (isError) return <div>Error fetching data</div>
10+
if (isLoading) return <div>Loading...</div>
11+
12+
const redirect = (e) => {
13+
e.preventDefault()
14+
router.push('/')
15+
}
16+
17+
return (
18+
<div className="font-sans">
19+
<div className="relative min-h-screen flex flex-col sm:justify-center items-center">
20+
<div className="relative sm:max-w-sm w-full">
21+
<div className="card bg-secondary-content shadow-lg w-full h-full rounded-3xl absolute transform -rotate-6" />
22+
<div className="card bg-secondary shadow-lg w-full h-full rounded-3xl absolute transform rotate-6" />
23+
<div className="relative w-full rounded-3xl px-6 py-4 bg-gray-100 shadow-md">
24+
<label className="block mt-3 text-sm text-gray-700 text-center font-semibold">
25+
Log In
26+
</label>
27+
<form onSubmit={(e) => redirect(e)} className="mt-10">
28+
<div>
29+
<input type="email" placeholder="Email" className="mt-1 block w-full border-none bg-gray-100 h-11 rounded-xl shadow-lg hover:bg-blue-100 focus:bg-blue-100 focus:ring-0" />
30+
</div>
31+
<div className="mt-7">
32+
<input type="password" placeholder="Password" className="mt-1 block w-full border-none bg-gray-100 h-11 rounded-xl shadow-lg hover:bg-blue-100 focus:bg-blue-100 focus:ring-0" />
33+
</div>
34+
<div className="mt-7">
35+
<button className="bg-secondary-content w-full py-3 rounded-xl text-white shadow-xl hover:shadow-inner focus:outline-none transition duration-500 ease-in-out transform hover:-translate-x hover:scale-105">
36+
Register
37+
</button>
38+
</div>
39+
<div className="mt-7">
40+
<div className="flex justify-center items-center">
41+
<label className="mr-2">Do not you have an account yet?</label>
42+
<a className=" text-blue-500 transition duration-500 ease-in-out transform hover:-translate-x hover:scale-105">
43+
Sign Up
44+
</a>
45+
</div>
46+
</div>
47+
</form>
48+
</div>
49+
</div>
50+
</div>
51+
</div>
52+
)
53+
}
54+
55+
function useGetData() {
56+
const { data, error } = useSWR('http://localhost:3000/api/users', fetcher)
57+
return {
58+
user: data,
59+
isLoading: !error && !data,
60+
isError: error
61+
}
62+
}

0 commit comments

Comments
 (0)