implement item dtos
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-22 00:56:24 -05:00
parent 3d219b8cf7
commit 67baddf9d0
5 changed files with 35 additions and 23 deletions

View File

@@ -5,7 +5,7 @@
// sighh
import { defineStore } from "pinia";
import type { Item } from "../models/Item.ts";
import type { Item, ItemDto } from "../models/Item.ts";
import * as itemsApi from "../api/ItemsApi";
interface ItemState {
@@ -28,15 +28,15 @@ export const useItemsStore = defineStore("items", {
this.loading = false;
},
async addItem(item: Item) {
async addItem(item: ItemDto) {
const response = await itemsApi.createItem(item);
this.items.push(response.data);
},
async updateItem(id: number, item: Item) {
await itemsApi.updateItem(id, item);
async updateItem(id: number, item: ItemDto) {
const response = await itemsApi.updateItem(id, item);
const index = this.items.findIndex(i => i.id === id);
this.items[index] = item;
this.items[index] = response.data;
},
async removeItem(id: number) {