@@ -8,7 +8,7 @@ import type { Dispatch, SetStateAction } from 'react'
88import { useEffect , useState } from 'react'
99import { Button } from '~/components'
1010import { ApiClient } from '~/lib/apiClient'
11- import type { Access , InstanceConfig , SubjectId } from '~/lib/types'
11+ import type { Access , InstanceConfig } from '~/lib/types'
1212import { CONFIG } from '~/lib/parse_config.server'
1313
1414interface ConsentScreenContext {
@@ -20,7 +20,7 @@ interface ConsentScreenContext {
2020 returnUrl : string
2121 accesses : Array < Access > | null
2222 outgoingPaymentAccess : Access | null
23- subjectId : SubjectId | null
23+ subjectId : string | null
2424 price : GrantAmount | null
2525 costToUser : GrantAmount | null
2626 errors : Array < Error >
@@ -64,7 +64,7 @@ function ConsentScreenBody({
6464 interactId : string
6565 nonce : string
6666 returnUrl : string
67- subjectId : SubjectId | null
67+ subjectId : string | null
6868} ) {
6969 const chooseConsent = ( accept : boolean ) => {
7070 const href = new URL ( returnUrl )
@@ -82,7 +82,7 @@ function ConsentScreenBody({
8282 { subjectId && (
8383 < p >
8484 { thirdPartyName } is asking you to confirm ownership of{ ' ' }
85- { subjectId . id } .
85+ { subjectId } .
8686 </ p >
8787 ) }
8888 </ div >
@@ -365,14 +365,15 @@ export default function ConsentScreen({ idpSecretParam }: ConsentScreenProps) {
365365 : AmountType . UNLIMITED
366366 )
367367 }
368- returnUrlObject . searchParams . append (
369- 'subjectId' ,
370- response . payload . subject . sub_ids [ 0 ] ?. id ?? null
371- )
368+
369+ const subjectId = response . payload . subject ?. sub_ids [ 0 ] ?. id ?? null
370+ if ( subjectId ) {
371+ returnUrlObject . searchParams . append ( 'subjectId' , subjectId )
372+ }
372373 setCtx ( {
373374 ...ctx ,
374375 accesses : response . payload . access ,
375- subjectId : response . payload . subject . sub_ids [ 0 ] ,
376+ subjectId,
376377 outgoingPaymentAccess : outgoingPaymentAccess ,
377378 thirdPartyName : ctx . thirdPartyName ,
378379 thirdPartyUri : ctx . thirdPartyUri ,
0 commit comments