[INJIMOB-3027] add fallback if display property of credential type is missing (#1832)

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
abhip2565
2025-03-14 08:26:52 +05:30
committed by GitHub
parent 62298c8768
commit f07d1c528c
2 changed files with 4 additions and 3 deletions

View File

@@ -268,7 +268,7 @@ export const getCredentialType = (
if (supportedCredentialsWellknown.format === VCFormat.ldp_vc) {
const types = supportedCredentialsWellknown.credential_definition
.type as string[];
return types[1];
return types[types.length - 1];
} else {
return i18n.t('VcDetails:identityCard');
}

View File

@@ -7,11 +7,12 @@ import {displayType} from '../../machines/Issuers/IssuersMachine';
import {SvgImage} from '../ui/svg';
import {getDisplayObjectForCurrentLanguage} from '../../shared/openId4VCI/Utils';
import {CredentialTypes} from '../../machines/VerifiableCredential/VCMetaMachine/vc';
import { getCredentialType } from '../VC/common/VCUtils';
export const CredentialType: React.FC<CredentialTypeProps> = props => {
const selectedIssuerDisplayObject = props.item.display?.length
? getDisplayObjectForCurrentLanguage(props.item.display)
: {};
: {name:getCredentialType(props.item)};
return (
<Pressable
@@ -40,7 +41,7 @@ export const CredentialType: React.FC<CredentialTypeProps> = props => {
<Text
testID={`credentialTypeHeading-${props.testID}`}
style={Theme.IssuersScreenStyles.issuerHeading}>
{selectedIssuerDisplayObject?.name}
{selectedIssuerDisplayObject.name as string}
</Text>
</View>
</Pressable>