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 committed by Yury
parent a70ef3371f
commit 8ebeb7ef93

View File

@ -51,7 +51,7 @@ enum SignedStatus {
}
export const SignPage = () => {
const [searchParams] = useSearchParams()
const [searchParams, setSearchParams] = useSearchParams()
const [displayInput, setDisplayInput] = useState(false)
@ -123,7 +123,7 @@ export const SignPage = () => {
const fileName = fileUrl.split('/').pop()
const file = new File([res.data], fileName!)
decrypt(file, key).then((arrayBuffer) => {
decrypt(file, decodeURIComponent(key)).then((arrayBuffer) => {
if (arrayBuffer) handleDecryptedArrayBuffer(arrayBuffer)
})
})
@ -376,6 +376,14 @@ export const SignPage = () => {
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 {
const nextSigner = meta.signers[signerIndex + 1]
await sendDM(