change users crud to items
All checks were successful
Build and Deploy Frontend / build-and-deploy (push) Successful in 8s
Build and Deploy API / build-and-deploy (push) Successful in 10s

This commit is contained in:
2026-03-21 23:44:26 -05:00
parent a9b4d136d5
commit 7ab03d8073
13 changed files with 172 additions and 151 deletions

View File

@@ -0,0 +1,44 @@
<script setup lang="ts">
import { onMounted } from "vue"
import { useRoute, useRouter } from "vue-router";
import { useItemsStore } from "../stores/ItemsStore.ts"
import * as authApi from "../api/AuthApi";
const store = useItemsStore()
const router = useRouter();
onMounted(() => {
store.fetchItems()
})
function logout() {
authApi.logout();
router.push("/login");
}
</script>
<template>
<div>
<h1>Items</h1>
<router-link to="/user/new">Create Item</router-link>
<table>
<tr v-for="item in store.items" :key="item.id">
<td>{{ item.name }}</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>
</td>
</tr>
</table>
<button @click="logout()">Logout</button>
</div>
</template>