added userDtos
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
import { onMounted } from "vue"
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useUsersStore } from "../stores/UsersStore.ts"
|
||||
import * as authApi from "../api/AuthApi";
|
||||
|
||||
const store = useUsersStore()
|
||||
const router = useRouter();
|
||||
|
||||
onMounted(() => {
|
||||
store.fetchUsers()
|
||||
})
|
||||
|
||||
function logout() {
|
||||
authApi.logout();
|
||||
router.push("/login");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h1>Users</h1>
|
||||
|
||||
<table>
|
||||
<tr v-for="user in store.users" :key="user.id">
|
||||
<td>{{ user.username }}</td>
|
||||
<td>
|
||||
<button @click="store.removeUser(user.id)">Delete</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button @click="logout()">Logout</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user