PropertyType Management abgeschlossen
This commit is contained in:
@@ -66,6 +66,7 @@ export async function getPropertyTypesByGroupId(groupId: number): Promise<Proper
|
||||
.get(`${API_BASE_URL}/getPropertyTypesByGroupId/${groupId}`)
|
||||
.json<ApiResponse<BackendPropertyType[]>>()
|
||||
|
||||
return response.data.map(toClientPropertyType)
|
||||
// the backend returns null instead of [] when there are no matching property types
|
||||
return (response.data ?? []).map(toClientPropertyType)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ export async function getPropertyTypeGroupsByParentId(parentId: number): Promise
|
||||
.get(`${API_BASE_URL}/getPropertyTypeGroupsByParentId/${parentId}`)
|
||||
.json<ParentGroupsResponse>()
|
||||
|
||||
return response.data
|
||||
// the backend returns null instead of [] when there are no matching groups
|
||||
return response.data ?? []
|
||||
}
|
||||
|
||||
export async function deletePropertyTypeFromPropertyTypeGroupId(propertyTypeGroupId: number): Promise<void> {
|
||||
|
||||
@@ -25,7 +25,8 @@ export async function getValuesFromPropertyTypeId(propertyTypeId: number): Promi
|
||||
.get(`${API_BASE_URL}/getValuesFromPropertyTypeId/${propertyTypeId}`)
|
||||
.json<ApiResponse<Value[]>>()
|
||||
|
||||
return response.data
|
||||
// the backend returns null instead of [] when there are no matching values
|
||||
return response.data ?? []
|
||||
}
|
||||
|
||||
export async function getValuesFromPropertyId(propertyId: number): Promise<Value[]> {
|
||||
@@ -33,7 +34,7 @@ export async function getValuesFromPropertyId(propertyId: number): Promise<Value
|
||||
.get(`${API_BASE_URL}/getValuesFromPropertyId/${propertyId}`)
|
||||
.json<ApiResponse<Value[]>>()
|
||||
|
||||
return response.data
|
||||
return response.data ?? []
|
||||
}
|
||||
|
||||
export async function deleteValueFromPropertyId(valueId: number, propertyId: number): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user