@@ -74,6 +74,8 @@ async function showFormDetails(formInfo) {
7474 const show = ! ! formInfo ;
7575 document . getElementById ( 'card-questionnary-details-nothing' ) . style . display = show ? 'none' : 'block' ;
7676 document . getElementById ( 'card-questionnary-details-something' ) . style . display = show ? 'block' : 'none' ;
77+ // clear navData
78+ patientLib . navSetData ( null ) ;
7779 if ( ! show ) return ;
7880 const formDetails = await patientHomeLib . getQuestionnaryDetails ( formInfo ) ;
7981 console . log ( '## showFormDetails' , formDetails ) ;
@@ -102,13 +104,20 @@ async function showFormDetails(formInfo) {
102104 const buttonRevoke = document . getElementById ( 'revoke-access-button' ) ;
103105
104106 // -- pass the apiEndpoint to the next page !! Insecure just for demo
105- const openHREF = `patient-profile.html?patientApiEndpoint=${ patientHomeLib . getPatientApiEndpoint ( ) } &questionaryId=${ formInfo . questionaryId } ` ;
107+ const navData = {
108+ patientApiEndpoint : patientHomeLib . getPatientApiEndpoint ( ) ,
109+ questionaryId : formInfo . questionaryId
110+ }
111+ patientLib . navSetData ( navData ) ;
112+ console . log ( "## nav set data" , patientLib . navGetData ( ) )
113+
106114 if ( formDetails . status === 'accepted' ) {
107115 buttonOpen . innerHTML = 'Open' ;
108116 buttonOpen . onclick = async function ( ) {
109117 // -- hack publish access anyway (this should be done just once)
110118 await patientHomeLib . publishAccess ( formInfo , formDetails . sharedApiEndpoint ) ;
111- document . location . href = openHREF ;
119+ patientLib . navSetData ( )
120+ document . location . href = 'patient-profile.html' ;
112121 } ;
113122 buttonRevoke . innerHTML = 'Revoke' ;
114123 buttonRevoke . onclick = async function ( ) {
@@ -121,7 +130,7 @@ async function showFormDetails(formInfo) {
121130 buttonOpen . innerHTML = 'Grant access and Open' ;
122131 buttonOpen . onclick = async function ( ) {
123132 await patientHomeLib . grantAccess ( formInfo , formDetails ) ;
124- document . location . href = openHREF ;
133+ document . location . href = 'patient-profile.html' ;
125134 } ;
126135 buttonRevoke . innerHTML = 'Refuse' ;
127136 buttonRevoke . onclick = async function ( ) {
0 commit comments