Planungen android
This commit is contained in:
22
frontend/src/utils/paramValues.js
Normal file
22
frontend/src/utils/paramValues.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export function normalizeParamValues(data) {
|
||||
if (Array.isArray(data)) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (Array.isArray(data?.values)) {
|
||||
return data.values;
|
||||
}
|
||||
|
||||
if (Array.isArray(data?.paramValues)) {
|
||||
return data.paramValues;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function toTranslatedParamOptions(data, captionPrefix) {
|
||||
return normalizeParamValues(data).map((item) => ({
|
||||
value: item.id ?? item.value,
|
||||
captionTr: `${captionPrefix}.${item.name ?? item.value}`
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user