fix: In sign page, when doc is fully signed, update search params with update file url and key

This commit is contained in:
SwiftHawk 2024-05-16 10:38:27 +05:00
parent 32c9a062c4
commit 05c3f49a17

View File

@ -51,7 +51,7 @@ enum SignedStatus {
} }
export const SignPage = () => { export const SignPage = () => {
const [searchParams] = useSearchParams() const [searchParams, setSearchParams] = useSearchParams()
const [displayInput, setDisplayInput] = useState(false) const [displayInput, setDisplayInput] = useState(false)
@ -123,7 +123,7 @@ export const SignPage = () => {
const fileName = fileUrl.split('/').pop() const fileName = fileUrl.split('/').pop()
const file = new File([res.data], fileName!) const file = new File([res.data], fileName!)
decrypt(file, key).then((arrayBuffer) => { decrypt(file, decodeURIComponent(key)).then((arrayBuffer) => {
if (arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer) if (arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer)
}) })
}) })
@ -376,6 +376,14 @@ export const SignPage = () => {
setAuthUrl setAuthUrl
) )
} }
// when user is the last signer and has sent
// the final document to all the signers and viewers
// update search params with updated file url and encryption key
setSearchParams({
file: fileUrl,
key: encryptionKey
})
} else { } else {
const nextSigner = meta.signers[signerIndex + 1] const nextSigner = meta.signers[signerIndex + 1]
await sendDM( await sendDM(