Skip to content

Commit

Permalink
feat(app/utils/url.ts): update asset profile url
Browse files Browse the repository at this point in the history
Update the URL format of the asset profile from
`/asset-profile?nid=${nid}` to `/asset-profile/${nid}`.
Remove the unused "tmp_token" from the asset profile URL.
  • Loading branch information
olgahaha committed Apr 22, 2024
1 parent 35a2c98 commit d31ebd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class CaptureDetailsWithIonicComponent {
captionOn = true;

readonly detailedCapture$ = new ReplaySubject<DetailedCapture>(1);
readonly detailedCaptureTmpShareToken$ = new ReplaySubject<string>(1);
readonly thumbnailUrl$ = this.detailedCapture$.pipe(
switchMap(capture => capture.proof$),
isNonNullable(),
Expand Down Expand Up @@ -68,11 +67,6 @@ export class CaptureDetailsWithIonicComponent {
if (value) this.detailedCapture$.next(value);
}

@Input()
set detailedCaptureTmpShareToken(value: string | undefined) {
if (value) this.detailedCaptureTmpShareToken$.next(value);
}

constructor(
private readonly translocoService: TranslocoService,
private readonly datePipe: DatePipe,
Expand Down Expand Up @@ -100,16 +94,15 @@ export class CaptureDetailsWithIonicComponent {
}

openCertificate() {
combineLatest([this.detailedCapture$, this.detailedCaptureTmpShareToken$])
combineLatest([this.detailedCapture$])
.pipe(
first(),
concatMap(([detailedCapture, tmpShareToken]) =>
concatMap(([detailedCapture]) =>
defer(() =>
Browser.open({
url: getAssetProfileForNSE(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
detailedCapture.id!,
tmpShareToken
detailedCapture.id!
),
toolbarColor: '#564dfc',
})
Expand Down
7 changes: 2 additions & 5 deletions src/app/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ export function toDataUrl(base64: string, mimeType: MimeType | string) {
return `data:${mimeType};base64,${base64}`;
}

export function getAssetProfileForNSE(id: string, token?: string) {
if (token) {
return `https://verify.numbersprotocol.io/asset-profile?nid=${id}&tmp_token=${token}`;
}
return `https://verify.numbersprotocol.io/asset-profile?nid=${id}`;
export function getAssetProfileForNSE(id: string) {
return `https://verify.numbersprotocol.io/asset-profile/${id}`;
}

export function getAssetProfileForCaptureIframe(cid: string) {
Expand Down

0 comments on commit d31ebd4

Please sign in to comment.