+ className="w-full bg-white rounded-lg shadow md:mt-0 sm:max-w-md xl:p-0">
-
- Sign in to your account
+
+ Login to your account
-
diff --git a/webapp/src/pages/register/index.jsx b/webapp/src/pages/register/index.jsx
index 7de5649..7f460ef 100644
--- a/webapp/src/pages/register/index.jsx
+++ b/webapp/src/pages/register/index.jsx
@@ -1,10 +1,79 @@
+import {Link, redirect, useNavigate} from "react-router-dom";
+import {post} from "../../modules/fetcher";
+import {useState} from "react";
-function Register() {
+function Register({setToken}) {
+ const navigate = useNavigate();
+ const registerUser = async (e) => {
+ e.preventDefault()
+ if(password === confirmPassword) {
+ post('https://saucisson.justw.tf/api/users/register', {username, password}, '')
+ .then(async res => {
+ if (res.status === 200) {
+ setToken(res.JSON.token)
+ navigate('/')
+ } else {
+ setError(res.message)
+ }
+ })
+ } else {
+ setError("Password doesn't match")
+ }
+
+ }
+ const [error, setError] = useState(null)
+ const [username, setUsername] = useState(null)
+ const [password, setPassword] = useState(null)
+ const [confirmPassword, setconfirmPassword] = useState(null)
return (
-
-
-
+
+
+
+
+
+ Create an account
+
+
+
+
+
+
)
}