Skip to content

Commit

Permalink
Merge pull request #130 from wadeking98/fix-relationship-number
Browse files Browse the repository at this point in the history
fixed relationship decription on creds
  • Loading branch information
wadeking98 authored Jan 18, 2022
2 parents 2e83568 + 5ef58fb commit 3bc038f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/components/entity/CredentialItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,18 @@ export default class HighlightedCredItem extends Vue {
if (!this.cred) {
return undefined;
}
let retval: { [index: string]: string } = {};
let retval: { [index: string]: string | undefined } = {};
const claimLabel = this.getClaimLabel(
this.cred.credential_type_id,
this.cred.credential_title
);
const default_title = this.cred.rel_id
? { "Relationship description": this.cred.rel_id as string }
: { "Registration number": this.sourceId };
if (claimLabel === undefined) {
retval = { "Registration number": this.sourceId };
retval = default_title;
} else {
let value = selectFirstAttrItem(
{ key: "type", value: this.cred.credential_title },
Expand All @@ -198,13 +202,13 @@ export default class HighlightedCredItem extends Vue {
if (value?.value) {
retval[claimLabel] = value.value as string;
} else {
retval = { "Registration number": this.sourceId };
retval = default_title;
}
}
let accessor = this.cred.credential_title ? this.cred.credential_title : "";
return {
key: Object.keys(retval)[0],
value: retval[Object.keys(retval)[0]],
value: retval[Object.keys(retval)[0]] as string,
accessor: accessor,
};
}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/api/v4/credential.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface ICredential extends IApiResource {
export interface ICredentialDisplayType {
id: number;
credential_type: string;
rel_id?: string;
type: string;
authority: string;
authorityLink: string | URL;
Expand Down
1 change: 1 addition & 0 deletions src/utils/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function credOrRelationshipToDisplay(
const relItem = item as IRelationship;

display.id = relItem.credential.id;
display.rel_id = relItem.related_topic?.source_id;
display.authority = "";
display.authorityLink = "";
if (credSet !== undefined) {
Expand Down

0 comments on commit 3bc038f

Please sign in to comment.