This commit is contained in:
Nikola Petrov
2023-10-04 20:19:16 +02:00
parent ea623cedc8
commit 63346de8c1
12 changed files with 61 additions and 58 deletions

View File

@@ -25,30 +25,30 @@
<div class="btn btn-primary" id="get"> Get</div>
<br>
<div id="text"></div>
<script>
async function deleteUser(){
async function deleteUser() {
const password = document.getElementById('password').value;
const response = await fetch('/user', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({"password": password}),
body: JSON.stringify({ "password": password }),
})
const data = await response.json();
document.getElementById('text').innerHTML = data.message;
document.getElementById('text').innerHTML = data.message;
}
async function getUser(){
async function getUser() {
const password = document.getElementById('password').value;
const response = await fetch('/user', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({"password": password}),
body: JSON.stringify({ "password": password }),
})
const data = await response.json();
console.log(data);