Add Sigit ID as a path param #195

Open
m wants to merge 10 commits from issue-171 into staging
Showing only changes of commit 86a16c13ce - Show all commits

View File

@ -71,18 +71,22 @@ export const SignPage = () => {
* Received from `location.state` * Received from `location.state`
* *
* uploadedZip will be received from home page when a user uploads a sigit zip wrapper that contains keys.json * uploadedZip will be received from home page when a user uploads a sigit zip wrapper that contains keys.json
* arrayBuffer will be received in navigation from create page in offline mode * arrayBuffer (decryptedArrayBuffer) will be received in navigation from create page in offline mode
* meta will be received in navigation from create & home page in online mode * meta (metaInNavState) will be received in navigation from create & home page in online mode
m marked this conversation as resolved Outdated
Outdated
Review

We should just replace the value of metaInNavState without having states.
We can just move it out of the destructuring and modify it if needed? Something like?

  const { arrayBuffer: decryptedArrayBuffer, uploadedZip } = location.state

  let metaInNavState = location.state.meta
  if (usersAppData) {
    const sigitId = params.id

    if (sigitId) {
      metaInNavState = usersAppData.sigits[sigitId]
    }
  }
We should just replace the value of `metaInNavState` without having states. We can just move it out of the destructuring and modify it if needed? Something like? ``` const { arrayBuffer: decryptedArrayBuffer, uploadedZip } = location.state let metaInNavState = location.state.meta if (usersAppData) { const sigitId = params.id if (sigitId) { metaInNavState = usersAppData.sigits[sigitId] } } ```
*/ */
let metaInNavState = location.state.meta let metaInNavState = location?.state?.meta || undefined
const { arrayBuffer: decryptedArrayBuffer, uploadedZip } = location.state || { const { arrayBuffer: decryptedArrayBuffer, uploadedZip } = location.state || {
meta: undefined, decryptedArrayBuffer: undefined,
arrayBuffer: undefined,
uploadedZip: undefined uploadedZip: undefined
} }
/**
* If userAppData (redux) is available, and we have route param (sigit id)
m marked this conversation as resolved Outdated
Outdated
Review

sigit id - what is this? should be defined

sigit id - what is this? should be defined
* we will fetch a sigit based on the provided route ID and set it
* to the metaInNavState
*/
if (usersAppData) { if (usersAppData) {
// Sigit id is a createEventId
const sigitId = params.id const sigitId = params.id
if (sigitId) { if (sigitId) {