delete user

This commit is contained in:
Tim Zieger 2020-05-26 10:17:42 +02:00
parent 5908de5650
commit d5ef0004f6
2 changed files with 18 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<template>
<v-container fluid>
<div v-bind:key="user.username" v-for="user in users">
<UsersItems v-bind:user="user" v-on:edit-user="edituser" v-on:show-accounts="showAccounts"/>
<UsersItems v-bind:user="user" v-on:edit-user="edituser" v-on:del-user="deluser" v-on:show-accounts="showAccounts"/>
</div>
</v-container>
</template>
@ -24,6 +24,22 @@ export default {
window.location.href = selfUri + "/edituser";
},
deluser(selfLink){
var userxhttp = new XMLHttpRequest();
userxhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 204) {
location.reload();
}
};
userxhttp.open("DELETE", selfLink , false);
userxhttp.setRequestHeader(
"Authorization",
sessionStorage.getItem("jwt")
);
userxhttp.send(null);
},
showAccounts(username, uid) {
sessionStorage.setItem("timeTrackAccountListUser", username);
sessionStorage.setItem("timeTrackAccountListUserId", uid);

View File

@ -44,7 +44,7 @@
<v-btn fab dark small color="green" @click="$emit('edit-user', user._links.self.href)">
<v-icon>mdi-file-document-edit</v-icon>
</v-btn>
<v-btn fab dark small color="red" @click="$emit('del-user', user.username)">
<v-btn fab dark small color="red" @click="$emit('del-user', user._links.self.href)">
<v-icon>mdi-delete</v-icon>
</v-btn>
</v-speed-dial>