mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 05:27:57 -05:00
[INJIMOB-3065] add fallback for missing display in credentialSubject fields of wellknown (#1850)
Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
@@ -126,23 +126,31 @@ export const getFieldName = (
|
||||
'Credential definition is not available for the selected credential type',
|
||||
);
|
||||
}
|
||||
let fieldObj = credentialDefinition?.credentialSubject[field];
|
||||
let fieldObj = credentialDefinition?.credentialSubject?.[field];
|
||||
if (fieldObj) {
|
||||
const newFieldObj = fieldObj.display.map(obj => {
|
||||
return {language: obj.locale, value: obj.name};
|
||||
});
|
||||
return getLocalizedField(newFieldObj);
|
||||
if (fieldObj.display && fieldObj.display.length > 0) {
|
||||
const newFieldObj = fieldObj.display.map(obj => ({
|
||||
language: obj.locale,
|
||||
value: obj.name,
|
||||
}));
|
||||
return getLocalizedField(newFieldObj);
|
||||
}
|
||||
return field;
|
||||
}
|
||||
} else if (format === VCFormat.mso_mdoc) {
|
||||
const splitField = field.split('~');
|
||||
if (splitField.length > 1) {
|
||||
const [namespace, fieldName] = splitField;
|
||||
const fieldObj = wellknown.claims[namespace][fieldName];
|
||||
const fieldObj = wellknown.claims?.[namespace]?.[fieldName];
|
||||
if (fieldObj) {
|
||||
const newFieldObj = fieldObj.display.map(obj => {
|
||||
return {language: obj.locale, value: obj.name};
|
||||
});
|
||||
return getLocalizedField(newFieldObj);
|
||||
if (fieldObj.display && fieldObj.display.length > 0) {
|
||||
const newFieldObj = fieldObj.display.map(obj => ({
|
||||
language: obj.locale,
|
||||
value: obj.name,
|
||||
}));
|
||||
return getLocalizedField(newFieldObj);
|
||||
}
|
||||
return fieldName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +158,7 @@ export const getFieldName = (
|
||||
return i18n.t(`VcDetails:${field}`);
|
||||
};
|
||||
|
||||
|
||||
export function getAddressFields() {
|
||||
return [
|
||||
'addressLine1',
|
||||
|
||||
Reference in New Issue
Block a user