add blocks
This commit is contained in:
16
static/blocks/pages/userSlava/new/script.js
Normal file
16
static/blocks/pages/userSlava/new/script.js
Normal file
@@ -0,0 +1,16 @@
|
||||
async function UserReg() {
|
||||
const u = reg_user.value,
|
||||
p = reg_pass.value;
|
||||
|
||||
const r = await fetch("/api/users/register", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username: u, password: p })
|
||||
});
|
||||
|
||||
if (!r.ok) return alert("Ошибка");
|
||||
alert("ok");
|
||||
reg_user.value = "",
|
||||
reg_pass.value = "";
|
||||
};
|
||||
btn_reg.onclick = UserReg;
|
||||
Reference in New Issue
Block a user