Merge branch '90-delete-user' into 'master'

Resolve "Delete User"

Closes #90

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!71
This commit is contained in:
Tim Zieger 2020-05-26 08:33:33 +00:00
commit 57e8541c0e
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>