Files
agologum/client/src/pages/UsersList.vue
Blitblank 500961be07
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 5s
Build and Deploy API / build-and-deploy (push) Successful in 9s
fix users page
2026-04-21 20:12:17 -05:00

38 lines
790 B
Vue

<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>