PropertyTypes integriert
This commit is contained in:
@@ -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[]>()
|
||||
}
|
||||
Reference in New Issue
Block a user