implement item dtos
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// this item service will handle all to <-> from the server when handling item objects
|
||||
|
||||
import api from "./axios.ts"
|
||||
import type { Item } from "../models/Item.ts";
|
||||
import type { Item, ItemDto } from "../models/Item.ts";
|
||||
|
||||
const API_URL: string = "/items";
|
||||
|
||||
@@ -11,8 +11,8 @@ export const getItems = () => api.get<Item[]>(`${API_URL}`);
|
||||
|
||||
export const getItem = (id: number) => api.get<Item>(`${API_URL}/${id}`);
|
||||
|
||||
export const createItem = (data: Item) => api.post<Item>(`${API_URL}`, data);
|
||||
export const createItem = (data: ItemDto) => api.post<Item>(`${API_URL}`, data);
|
||||
|
||||
export const updateItem = (id: number, data: Item) => api.put<Item>(`${API_URL}/${id}`, data);
|
||||
export const updateItem = (id: number, data: ItemDto) => api.put<Item>(`${API_URL}/${id}`, data);
|
||||
|
||||
export const deleteItem = (id: number) => api.delete<Item>(`${API_URL}/${id}`);
|
||||
|
||||
Reference in New Issue
Block a user