fix users page
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

This commit is contained in:
2026-04-21 20:12:17 -05:00
parent 143d194cdb
commit 500961be07
2 changed files with 9 additions and 14 deletions

View File

@@ -52,6 +52,8 @@ builder.Services.AddAuthorization(options => {
policy.RequireRole("admin", "superuser"));
options.AddPolicy("SensitiveDataModify", policy =>
policy.RequireRole("superuser"));
// TODO: policies are read at runtime. define policy names in a central place and distribute the symbol
});

View File

@@ -3,14 +3,14 @@
import { onMounted } from "vue"
import { useRoute, useRouter } from "vue-router";
import { useItemsStore } from "../stores/ItemsStore.ts"
import { useUsersStore } from "../stores/UsersStore.ts"
import * as authApi from "../api/AuthApi";
const store = useItemsStore()
const store = useUsersStore()
const router = useRouter();
onMounted(() => {
store.fetchItems()
store.fetchUsers()
})
function logout() {
@@ -22,20 +22,13 @@ function logout() {
<template>
<div>
<h1>Items</h1>
<router-link to="/item/new">Create Item</router-link>
<h1>Users</h1>
<table>
<tr v-for="item in store.items" :key="item.id">
<td>{{ item.name }}</td>
<tr v-for="user in store.users" :key="user.id">
<td>{{ user.username }}</td>
<td>
<router-link :to="`/item/${item.id}`" custom v-slot="{ navigate }">
<button @click="navigate" role="link">Edit</button>
</router-link>
<button @click="store.removeItem(item.id)">Delete</button>
<button @click="store.removeUser(user.id)">Delete</button>
</td>
</tr>
</table>