Files
simply_cpq/buildtime/client/material-editor/src/api/language/propertyGroup.api.ts
T

23 lines
935 B
TypeScript

import ky from 'ky'
import type { PropertyGroup } from '../../data/propertyGroup'
export const getPropertyGroups = async (): Promise<PropertyGroup[]> => {
return ky.get(`http://localhost:8088/propertygroups`).json<PropertyGroup[]>()
}
export const getPropertyGroupById = async (id: number): Promise<PropertyGroup> => {
return ky.get(`http://localhost:8088/propertygroup/${id}`).json<PropertyGroup>()
}
export const createPropertyGroup = async (propertyGroup: PropertyGroup): Promise<PropertyGroup> => {
return ky.post(`http://localhost:8088/propertygroup`, { json: propertyGroup }).json<PropertyGroup>()
}
export const updatePropertyGroup = async (propertyGroup: PropertyGroup): Promise<void> => {
await ky.put(`http://localhost:8088/propertygroup`, { json: propertyGroup })
}
export const deletePropertyGroup = async (id: number): Promise<void> => {
await ky.delete(`http://localhost:8088/propertygroup/${id}`)
}