Skip to content

Commit

Permalink
Develop (#72)
Browse files Browse the repository at this point in the history
* fix #43: stop navigation to disabled items with buttons

* fix #44: update change events

* fix #48: making spacing configurable

* enhancement #53: add support for icons

* fix #62: support for filedata for input file type

* fix #64: adding type for input mask

* cleanup linting

* fix build

* fix #66: file upload not working for section forms

* fix #68: adding multiselect control support

* fix #70: handle api errors
  • Loading branch information
manojadams committed May 10, 2024
1 parent f732d52 commit 42092cc
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions src/core/MetaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,23 +279,27 @@ export default class MetaForm implements IMetaForm {
section,
// eslint-disable-next-line camelcase
config?.urlType === URL_TYPE.REMOTE
).then((response: object) => {
const responseKey = config?.responseKey;
const results = responseKey ? response[responseKey] : response;
let newResults: Array<IOption> = [];
if (Array.isArray(results)) {
const labelKey = config?.labelKey ?? "label";
const valueKey = config?.valueKey ?? "value";
newResults = results.map((r: string) => {
const label = FormUtils.getDataFromValueKey(r, labelKey);
const value = FormUtils.getDataFromValueKey(r, valueKey);
return { label, value, ref: r };
});
resolve(newResults);
} else {
reject(new MetaformError("Response must be an array", response));
}
});
)
.then((response: object) => {
const responseKey = config?.responseKey;
const results = responseKey ? response[responseKey] : response;
let newResults: Array<IOption> = [];
if (Array.isArray(results)) {
const labelKey = config?.labelKey ?? "label";
const valueKey = config?.valueKey ?? "value";
newResults = results.map((r: string) => {
const label = FormUtils.getDataFromValueKey(r, labelKey);
const value = FormUtils.getDataFromValueKey(r, valueKey);
return { label, value, ref: r };
});
resolve(newResults);
} else {
reject(new MetaformError("Response must be an array", response));
}
})
.catch((error) => {
reject(new MetaformError("Server error", error));
});
break;
}
}
Expand Down

0 comments on commit 42092cc

Please sign in to comment.