Initial
This commit is contained in:
16
public/register.js
Normal file
16
public/register.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { postData } from "./client.js";
|
||||
|
||||
const registerForm = document.getElementById("registerForm");
|
||||
|
||||
if (registerForm) registerForm.onsubmit = async e => {
|
||||
e.preventDefault();
|
||||
let resultObject = await postData("http://134.209.36.64:3000/register", {
|
||||
username: registerForm.regUser.value,
|
||||
password: registerForm.regPass.value,
|
||||
role: registerForm.regRole.value
|
||||
});
|
||||
alert(resultObject.message);
|
||||
if (resultObject.success === true) {
|
||||
window.location.href = "login.html";
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user