parsley/app/javascript/components/TheAdminUserList.vue

52 lines
939 B
Vue
Raw Normal View History

2018-06-09 12:36:46 -05:00
<template>
<div>
<h1 class="title">User List</h1>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Admin?</th>
<th></th>
</tr>
</thead>
<tbody>
<tr v-for="u in userList" :key="u.id">
<td>{{u.name}}</td>
<td>{{u.email}}</td>
<td>{{u.admin}}</td>
<td>
<button type="button" class="button is-danger">X</button>
</td>
</tr>
</tbody>
</table>
</div>
</template>
2024-10-02 14:34:50 -05:00
<script setup>
2018-06-09 12:36:46 -05:00
2024-10-02 14:34:50 -05:00
import { onBeforeMount, ref } from "vue";
import { useLoadResource } from "../lib/useLoadResource";
2018-06-09 12:36:46 -05:00
import api from "../lib/Api";
2024-10-02 14:34:50 -05:00
const { loadResource } = useLoadResource();
const userList = ref([]);
2018-06-09 12:36:46 -05:00
2024-10-02 14:34:50 -05:00
onBeforeMount(() => {
loadResource(
2018-06-09 12:36:46 -05:00
api.getAdminUserList()
2024-10-02 14:34:50 -05:00
.then(list => userList.value = list)
);
});
2018-06-09 12:36:46 -05:00
</script>
<style lang="scss" scoped>
</style>