PropertyTypes integriert

This commit is contained in:
2026-08-04 22:51:10 +02:00
parent 8697336ba3
commit 19704fa89e
11 changed files with 647 additions and 3 deletions
@@ -0,0 +1,30 @@
import ky from 'ky'
import type { PropertyType } from '../../data/propertyType'
export const getPropertyTypes = async (): Promise<PropertyType[]> => {
return ky.get(`http://localhost:8088/propertytypes`).json<PropertyType[]>()
}
export const getPropertyTypeById = async (id: number): Promise<PropertyType> => {
return ky.get(`http://localhost:8088/propertytype/${id}`).json<PropertyType>()
}
export const createPropertyType = async (propertyType: PropertyType): Promise<PropertyType> => {
return ky.post(`http://localhost:8088/propertytype`, { json: propertyType }).json<PropertyType>()
}
export const updatePropertyType = async (propertyType: PropertyType): Promise<PropertyType> => {
return ky.put(`http://localhost:8088/propertytype`, { json: propertyType }).json<PropertyType>()
}
export const deletePropertyType = async (id: number): Promise<void> => {
return ky.delete(`http://localhost:8088/propertytype/${id}`).json<void>()
}
export const getPropertyTypesByPropertyGroupId = async (propertyGroupId: number): Promise<PropertyType[]> => {
return ky.get(`http://localhost:8088/propertytypes/${propertyGroupId}`).json<PropertyType[]>()
}
export const getAllPropertyTypes = async (): Promise<PropertyType[]> => {
return ky.get(`http://localhost:8088/propertytypes`).json<PropertyType[]>()
}