Create user

This commit is contained in:
2024-08-23 21:07:13 +02:00
parent 05db85eca1
commit b183e7bf43
6 changed files with 95 additions and 4 deletions

View File

@ -1,4 +1,3 @@
export function showUsers(api) {
const tbody = document.getElementById("user-table").getElementsByTagName("tbody")[0];
const token = localStorage.getItem("token");
@ -34,3 +33,24 @@ export function showUsers(api) {
}
});
}
export function showUser(api) {
const token = localStorage.getItem("token");
let id = window.location.pathname.split("/").pop();
const requestOptions = {
method: 'post',
headers: {
'Accept': `application/json`,
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token,
},
};
fetch(api + `/api/admin/all-users/${id}`, requestOptions)
.then(response => response.json())
.then(function (data) {
console.log(data);
});
}